Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello
Sorry for being rubbish but despite other examples i am still struggling. I have the string "hello" as a column heading in a sheet. I wish to create a macro that, for every time is run, assigns the cell value (eg A3 if "hello" is in A3) to a variable. i then have the code; Range("A3").Select <--- "A3" will become the variable Selection.EntireColumn.Insert to insert a new column. When the macro is re-run, the variable would hold the range "A4" in this instance, and move the string "hello" into cell A5. Thank you |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Rather than storing the cell as a variable, it might be easier to just refind
the column every time you run the macro: Dim Hello as Range Set Hello = Range("1:1").Find("hello") If Not (Hello Is Nothing) then Hello.EntireColumn.Insert (by the way I think you mixed up column and row in the example - but the technique could be modifed however necessary to meet your needs) -- - K Dales "RichHoughton" wrote: Hello Sorry for being rubbish but despite other examples i am still struggling. I have the string "hello" as a column heading in a sheet. I wish to create a macro that, for every time is run, assigns the cell value (eg A3 if "hello" is in A3) to a variable. i then have the code; Range("A3").Select <--- "A3" will become the variable Selection.EntireColumn.Insert to insert a new column. When the macro is re-run, the variable would hold the range "A4" in this instance, and move the string "hello" into cell A5. Thank you |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
To find rate of each item from item.xls and to copy price.xls | Excel Discussion (Misc queries) | |||
shortcut key for selecting the inactive cells surrounding a range | Excel Worksheet Functions | |||
Can Excel find & sort one item in all the cells in a column? | New Users to Excel | |||
can you find specific text in a string ignoring any other text | Excel Discussion (Misc queries) | |||
condition format for surrounding cells | Excel Discussion (Misc queries) |