How can you use Row() in a marco like this...

tim963

Board Regular
Joined
Aug 20, 2002
Messages
58
this does not work, excel 97. Thanks
sub test()
Dim r
r = row()
ActiveCell = 5 + r
End Sub
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Something like?

Code:
Sub test() 
   Dim r 
   r = Activecell.Row 
   ActiveCell.Offset(r,5).Select 
End Sub
 

gnaga

Well-known Member
Joined
Jul 9, 2002
Messages
700
Office Version
  1. 365
  2. 2016
  3. 2013
Platform
  1. Windows
If you want to select the cell below five rows from the currently selected cell then

Cells(ActiveCell.Row + 5, ActiveCell.Column).Select

GNaga
 

tim963

Board Regular
Joined
Aug 20, 2002
Messages
58

ADVERTISEMENT

I was trying to add the row number, Andrew’s example does what I need. thanks
 

Richie(UK)

MrExcel MVP
Joined
May 17, 2002
Messages
3,329
Andrew,

I appreciate that you were just sticking with the OP's original framework, but isn't the sub effectively just:

ActiveCell.Offset(0,5).Select

or, after clarification and using the other example GNaga

ActiveCell.Offset(0,5).Select


_________________<font color="blue"> «««<font color="red">¤<font color="blue"><font size=+1>Richie</font><font color="red">¤<font color="blue"> »»»</font>

caffeine_sample.gif
</gif>
This message was edited by Richie(UK) on 2002-09-10 06:12
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Richie,

Yes.

I stuck with the framework just to show him how to find the row.

Edit: And r is the row of the active cell not 0.
This message was edited by Andrew Poulsom on 2002-09-10 06:21
 

Forum statistics

Threads
1,144,510
Messages
5,724,784
Members
422,579
Latest member
Lekha mohanty

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
Top