![]() |
getting a simple macro to begin execution on the selected cell
I created a simple macro to rearrange some cells, but I need it to start
relative to the cell selected. It always goes back to the cell selected when I created the macro. I looked at the Visual Basic editor and it shows -- Range("A30").Select --, I don't want to start at "A30" every time, I want to have that be a variable. How can I do that? |
getting a simple macro to begin execution on the selected cell
ActiveCell.Select
or don't Select at all. -- Gary's Student gsnu200703 "bolchman" wrote: I created a simple macro to rearrange some cells, but I need it to start relative to the cell selected. It always goes back to the cell selected when I created the macro. I looked at the Visual Basic editor and it shows -- Range("A30").Select --, I don't want to start at "A30" every time, I want to have that be a variable. How can I do that? |
getting a simple macro to begin execution on the selected cell
Thanks for replying. Here is the macro. I want it to add line spacing, etc.
relative to the cell selected when I run it. Right now it looks hardwired for the cell "A30" and others. I don't know how to do that. Sub line_space() ' ' line_space Macro ' Macro recorded 2/2/2007 by ... ' ' Keyboard Shortcut: Ctrl+s ' Range("A30").Select Selection.EntireRow.Insert Selection.RowHeight = 12.75 Range("A32").Select Selection.EntireRow.Insert Selection.EntireRow.Insert Selection.EntireRow.Insert Selection.EntireRow.Insert Selection.EntireRow.Insert Selection.EntireRow.Insert Selection.EntireRow.Insert Selection.EntireRow.Insert Selection.EntireRow.Insert Selection.EntireRow.Insert Selection.EntireRow.Insert Selection.EntireRow.Insert Range("A43").Select Selection.RowHeight = 85 Range("A44").Select End Sub "Gary''s Student" wrote: ActiveCell.Select or don't Select at all. -- Gary's Student gsnu200703 "bolchman" wrote: I created a simple macro to rearrange some cells, but I need it to start relative to the cell selected. It always goes back to the cell selected when I created the macro. I looked at the Visual Basic editor and it shows -- Range("A30").Select --, I don't want to start at "A30" every time, I want to have that be a variable. How can I do that? |
All times are GMT +1. The time now is 01:30 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com