Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Return Number | Excel Discussion (Misc queries) | |||
Return the Row number | Excel Discussion (Misc queries) | |||
Find a value and return a corresponding number | Excel Worksheet Functions | |||
return row number | Excel Programming | |||
command to return the row number or cell number in excel? | Excel Programming |