The Min function arguments in vb

matt edri

New Member
Joined
Apr 19, 2011
Messages
3
Hi,

I need to calculate the minimal value from all the cells that are adjacent to the active cell in vb code

I tried using the min function like this:

Dim min As Double
min = WorksheetFunction.min(ActiveCell.Offset([-1,1], [-1,1]).Value)

but I got a runtime error of type mismatch

how do I define the argument for the min function as a dynamic range of cells?
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
OK that was solved after googling

now lets say I have this range of cells: G29:P38

how do I iterate through all of the cells in the range with for loops and find the minimal value like posted before?
 
Upvote 0
Thanks, but my intension was to iterate over each cell in the range and find the minimal value in the adjacent cells only, not the whole range...
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,626
Members
452,933
Latest member
patv

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top