View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
L. Howard Kittle[_2_] L. Howard Kittle[_2_] is offline
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