LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 287
Default select cell by variable name

Hi,

When I insert a row after I have recorded a macro, the macro stops referring
to the correct cells. To fix this, I tried naming all the cells variables
and having the macro refer to the variable names instead of the cell location
(ie. A1).

So instead of:

Range("A1").Select
Selection.Copy

I tried:

Range("pop1d").Select
Selection.Copy

but I get an error message that says "select method of range class failed".
What is the correct way to refer to variable names in visual basic? Also, is
there any other way to have visual basic auto-update and refer to the correct
cells if I were to insert a row after recording the macro?

Thanks,

Adam
 
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
Using formulas to select cells (Ex: Select every nth cell in a col Lakeview Photographic Services Excel Discussion (Misc queries) 2 March 15th 07 02:17 PM
Use a Variable to select a range Connie Excel Discussion (Misc queries) 3 October 19th 06 05:48 PM
Select one variable from a list of variables by clicking one cell Curt Excel Discussion (Misc queries) 2 July 21st 05 01:44 AM
Excel 2003: In a Macro,how to select a variable row length table Tonto Excel Discussion (Misc queries) 1 June 1st 05 03:47 PM
Range("C9:V9").Select ==> changing the 9 to a variable B. F. Excel Worksheet Functions 8 May 23rd 05 01:16 PM


All times are GMT +1. The time now is 03:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"