Hi ,
I am still not able to understand why you want the code for getting the minimum value of a row range , when the same can be achieved by using a simple formula.
You have a column where you want the minimum value of the range in that row ; for example , in one month , you want the minimum value of the range A2 : F2 in column G2.
As and whn you insert a column anywhere in the range of columns A through G , you want that the minimum function formula should change so as to take the newly inserted column into account. Thus , if a new column inserted immediately to the left of column G , the formula in column G , which was =MIN(A2:F2) will now be in column H , and it should change to =MIN(A2:G2)
Is this correct ?
If it is , what I said earlier is that instead of using the formula :
=MIN(A2:F2)
use the formula :
=MIN(A2:OFFSET(G2,,-1))
Now , if you insert a column anywhere to the left of column G , this formula will automatically change to include the newly inserted column.
Is this not what you want VBA code to do ?
If it is , then what is the problem with using this formula ?
How does doing the same thing in VBA help ?
Or are you saying that you want the minimum value to be calculated within the code , and you do not want it inserted in a worksheet cell ?
Please clarify.
Narayan