Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to Select A Cell in VBA with a Variable Row Number?

Here are examples of normal VBA that works with no variables:

Range("K20").Select
Range("K20").Activate

I want to replace row 20 with a variable from a named cell.

For example, I named cell Z100 as "XRow". XRow now contains the number 7, which can change anytime according to formula. I want the formula to say something like the following, but I can't get it to work:

Range("KXrow").Select
Range("K"Xrow"").Select
Range(Cells(K,Xrow)).Select
Range(Cells(K,"Xrow")).Select

If necessary, I could make do with an unnamed cell, so that it could look something like

Range("KZ100").Select
Range("K"Z100"").Select
Range(Cells(K,Z100)).Select
Range(Cells(K,"Z100")).Select


Any ideas? Thanks!
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
select cell by variable name Adam Excel Discussion (Misc queries) 6 May 20th 08 07:54 PM
Select Variable Number of Columns Mike H. Excel Programming 4 July 9th 07 05:46 AM
I am trying to select a new cell whose row address is based on a variable rub Excel Programming 4 November 29th 06 03:49 AM
Select Cell based on Variable address achidsey Excel Programming 2 September 17th 05 06:47 PM


All times are GMT +1. The time now is 10:21 AM.

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"