How do I get the Function row and not the active row?

USAMax

Well-known Member
Joined
May 31, 2006
Messages
846
Office Version
  1. 365
Platform
  1. Windows
I wrote a function that works when I enter it one row at a time because it uses the ActiveCell.row function. But when I copy that function down all of the results are looking at the ActiveCell's row and not the row the function is on. Here is the command, how do I change it?

Code:
    CurRow = ActiveCell.Row
        If Cells(CurRow, q) = MaxVal Then
            MaxMinRevenueYears = Right(Cells(HeaderRow - 1, q), 4)
            Exit For
        End If
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
An example of my problem is, I copy the formula is in cell S5 and paste it down to S100.

The results in the pasted rows show the results for row 5 as it is the active row.
 
Upvote 0
I wrote a function that works when I enter it one row at a time because it uses the ActiveCell.row function. But when I copy that function down all of the results are looking at the ActiveCell's row and not the row the function is on. Here is the command, how do I change it?

Rich (BB code):
    CurRow = ActiveCell.Row
        If Cells(CurRow, q) = MaxVal Then
            MaxMinRevenueYears = Right(Cells(HeaderRow - 1, q), 4)
            Exit For
        End If

Try this instead...

CurRow = Application.Caller.Row
 
Upvote 0

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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