Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA: how do I return a row number?


How do I return a row number of an Excel workSheet to use in
formula?...


Then...

lets soppose I return row number 45. How do I select the columns
through 20 in row 45 (45 would need to be a variable that changes

--
Mcastee
-----------------------------------------------------------------------
Mcasteel's Profile: http://www.excelforum.com/member.php...fo&userid=1569
View this thread: http://www.excelforum.com/showthread.php?threadid=27430

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default how do I return a row number?

Try this

Sub test()
Dim rnum As Long
rnum = 45
Range(Cells(rnum, 1), Cells(rnum, 20)).Select
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Mcasteel" wrote in message ...

How do I return a row number of an Excel workSheet to use in a
formula?...


Then...

lets soppose I return row number 45. How do I select the columns 1
through 20 in row 45 (45 would need to be a variable that changes)


--
Mcasteel
------------------------------------------------------------------------
Mcasteel's Profile: http://www.excelforum.com/member.php...o&userid=15698
View this thread: http://www.excelforum.com/showthread...hreadid=274302



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default how do I return a row number?

Hi Mcasteel,

If you want to be able to just type the SSN in a cell and have the macro
look it up and select the 20 columns, then this might help.

Sub SSN()
Dim i As Long
i = Range("F1").Value
Range("A" & i).Resize(1, 20).Select
End Sub

Or you could just change Ron's code to let rnum = a cell value, in this case
F1.

Sub test()
Dim rnum As Long
rnum = Range("F1").Value
Range(Cells(rnum, 1), Cells(rnum, 20)).Select
End Sub

HTH
Regards,
Howard

"Mcasteel" wrote in message
...

How do I return a row number of an Excel workSheet to use in a
formula?...


Then...

lets soppose I return row number 45. How do I select the columns 1
through 20 in row 45 (45 would need to be a variable that changes)


--
Mcasteel
------------------------------------------------------------------------
Mcasteel's Profile:
http://www.excelforum.com/member.php...o&userid=15698
View this thread: http://www.excelforum.com/showthread...hreadid=274302



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Return Number George Excel Discussion (Misc queries) 2 March 3rd 09 05:49 PM
Return the Row number Kenneth Excel Discussion (Misc queries) 3 November 19th 08 08:45 AM
Find a value and return a corresponding number Irene Excel Worksheet Functions 3 May 11th 06 06:56 PM
return row number Jonathan Vickers Excel Programming 3 February 22nd 04 12:18 AM
command to return the row number or cell number in excel? desmondleow[_5_] Excel Programming 1 December 11th 03 10:51 AM


All times are GMT +1. The time now is 05:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"