Excel vba - return a row number

I have the following code:

Dim rRepCell As Variant
Dim rRepRow As Integer

Application.Goto Reference:="Reps"    'existing range
ActiveCell.Offset(1, 1).Range("A1").Select
Selection.End(xlDown).Select
rRepCell = ActiveCell.Address(0, 0)
rRepRow = Selection.Row(rRepCell)

Where the line:

rRepRow = Selection.Row(rRepCell)

produces an error: Runtime error 451. Property let procedure not defined and property get procedure did not return an object.

Thanks in advance.

May 26th, 2015 3:14pm

Can you explain what you want to accomplish?
Free Windows Admin Tool Kit Click here and download it now
May 26th, 2015 4:49pm

Hi

I'm not sure what your after but this will give you the row number.

rRepRows = Selection.Row

Just remove this (rRepCell)

May 26th, 2015 4:56pm

Based on the added remark in Excel vba - get the row number:

rRepRow = Range("Reps").Cells(1, 1).Offset(1, 1).End(xlDown).Row

Free Windows Admin Tool Kit Click here and download it now
May 26th, 2015 5:01pm

Hi NevadaMax,

Please try the above suggestions, please you have further question about Excel DEV, I recommend you post the question to the MSDN forum for Excel

http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc

The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

George Zhao
TechNet Community Support

May 28th, 2015 9:43pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics