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 |
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 |
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 |
All times are GMT +1. The time now is 11:58 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com