Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Can the column index in a cell address be made variable?

Hi,

To refer to a cell with a variable row number, we can just code it as,
for example,

Dim i As Interger
i=234
Range("A" & i).Select

To refer to a cell with a variable column index, it seems not that easy
because the column
index must be explicitly specified in a cell address. So, if I want to
go to the j th column on the 2nd row or j columns to the right of cell
AA3, is there a quick and easy way to do it? Thank you in advance.


David

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Can the column index in a cell address be made variable?

If you just want a single cell, use MySheet.Cells(i,j).
If you want a range, you can use

with MySheet
.Range(.Cells(i1,j1), .Cells(i2,j2))....
end with






"cyberdude" wrote in message
ups.com...
Hi,

To refer to a cell with a variable row number, we can just code it as,
for example,

Dim i As Interger
i=234
Range("A" & i).Select

To refer to a cell with a variable column index, it seems not that easy
because the column
index must be explicitly specified in a cell address. So, if I want to
go to the j th column on the 2nd row or j columns to the right of cell
AA3, is there a quick and easy way to do it? Thank you in advance.


David



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Can the column index in a cell address be made variable?

don't forget to check your post in .misc.

cyberdude wrote:

Hi,

To refer to a cell with a variable row number, we can just code it as,
for example,

Dim i As Interger
i=234
Range("A" & i).Select

To refer to a cell with a variable column index, it seems not that easy
because the column
index must be explicitly specified in a cell address. So, if I want to
go to the j th column on the 2nd row or j columns to the right of cell
AA3, is there a quick and easy way to do it? Thank you in advance.

David


--

Dave Peterson
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
Can I made a cell reference variable? i.e. =sum(D4:D(4+A2)) timothy Excel Worksheet Functions 2 July 11th 08 07:14 AM
Can the column index in a cell address be made variable? cyberdude Excel Discussion (Misc queries) 1 November 20th 05 02:47 AM
How can I use a variable as cell address? Matt[_33_] Excel Programming 9 September 27th 05 09:01 PM
Setting a variable cell address Hugh Jago Excel Discussion (Misc queries) 3 January 5th 05 03:45 PM
Vlookup - column index number - create as variable john young Excel Programming 2 August 6th 04 02:53 AM


All times are GMT +1. The time now is 01:07 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"