![]() |
Varible in a Range
Is there a way to specify a range based on a varible, for example
Range("Asomenumber").Select eg. where somenumber = 5, so that A5 in this case is selcted, but i somenumber changed then another cell selected -- Message posted from http://www.ExcelForum.com |
Varible in a Range
As far as I know, the only way to create ranges based on variables is by using the Cells collection. For example: myWS.Cells(myRow, myCol).Select myWS - Worksheet Object myRow - an Int or Long ( 32768 limitation on some systems) myCol - Int -----Original Message----- Is there a way to specify a range based on a varible, for example Range("Asomenumber").Select eg. where somenumber = 5, so that A5 in this case is selcted, but if somenumber changed then another cell selected. |
Varible in a Range
mushy_peas < wrote:
Is there a way to specify a range based on a varible, for example Range("Asomenumber").Select eg. where somenumber = 5, so that A5 in this case is selcted, but if somenumber changed then another cell selected. SomeNumber = 5 Range("A" & SomeNumber).Select Will get you to A5. Regards, -- Beto Reply: Erase between the dot (inclusive) and the @. Responder: Borra la frase obvia y el punto previo. |
Varible in a Range
I tried the myWS method cos i wanted to specify the colume too. but i
coulndt get it to work. one thing i spottte was:- (myRow, myCol). normally its colum then row, eg B10 any ideas why. this is what i have Dim myWS As Object Dim myRow As Integer Dim myCol As Integer myRow = 10 myCol = 2 ' myWS.Cells(myCol, myRow).Select myWS.Cells(myRow, myCol).Select --- Message posted from http://www.ExcelForum.com/ |
All times are GMT +1. The time now is 03:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com