Passing a row into a function

Sandler

Board Regular
Joined
Sep 15, 2011
Messages
165
How do I pass a row into a function.

For example if i have a hypothetical function named hypothetical and I am running it on Row 10, I want it to pass row 10 into the function. i.e. =hypothetical(10). If i have the rows filtered and visible are rows 10,15,20.
Then I want to drag down the formula and it grabs the correct row. i.e. =hypothetical(10), =hypothetical(15), =hypothetical(20), respectively.

Thanks.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Thanks, this is what I ended up passing, which worked.

Dim rowNum As Integer

rowNum = row.row
 
Upvote 0
How do I pass a row into a function.

For example if i have a hypothetical function named hypothetical and I am running it on Row 10, I want it to pass row 10 into the function. i.e. =hypothetical(10). If i have the rows filtered and visible are rows 10,15,20.
Then I want to drag down the formula and it grabs the correct row. i.e. =hypothetical(10), =hypothetical(15), =hypothetical(20), respectively.
The declaration for your function would need to look like this...

Function Hypothetical(Rw As Range)

and you would pass the entire row into the function by calling it like this...

SomeVariable = Hypothetical(Row(10))

Inside the function, the Rw argument would be a range referencing Row 10.
 
Upvote 0

Forum statistics

Threads
1,215,761
Messages
6,126,735
Members
449,333
Latest member
Adiadidas

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