Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default 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.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default 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.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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/

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
same varible in formula jheiser57 Excel Worksheet Functions 0 June 21st 10 04:49 PM
varible calculation kinsey New Users to Excel 7 September 30th 07 08:50 AM
varible table not spxer Excel Worksheet Functions 3 August 4th 06 05:13 PM
varible table spxer Excel Worksheet Functions 1 August 3rd 06 08:30 PM
how to start from varible row Vimal[_2_] Excel Programming 2 October 14th 03 08:44 AM


All times are GMT +1. The time now is 01:02 PM.

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"