Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default 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?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default 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?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default 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?

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
Jump to next cell after selecting from drop down list Sandie Excel Worksheet Functions 8 November 16th 06 04:06 PM
insert date Larry Excel Worksheet Functions 28 July 15th 06 02:41 AM
Compiling macro based on cell values simonsmith Excel Discussion (Misc queries) 1 May 16th 06 08:31 PM
Running a macro in a selected cell... Steve Excel Discussion (Misc queries) 2 January 19th 06 10:58 PM
Perform oiperations relative to initial selected cell scratching my head Excel Discussion (Misc queries) 1 May 30th 05 05:42 PM


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