#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default Macro problems

Hi I am trying to record a simple macro where if I press alt+d the location
moves 7 "page down" key strokes - about 100 rows.
However when I record the macro it resorts back to the line number that my
macro originally ended up at 7 keystrokes from the top., even if I am 1500
lines down.
How can I resolve this?

With thanks
Stephen

(My apologies if this is duplicated as I cannot see the original post after
12 hours)

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 427
Default Macro problems

When you record a macro, Excel picks up all the details: where is the
cell pointer located, etc, and assumes you want to replicate that each
time. Most likely your macro has a row in it that says something like
Range("A1").Select, which is where you were when you recorded.

To fix it, save your working file and work from a backup copy so you
don't lose data. Open the file; on the menu click Tools Macro
Macros and highlight the macro you recorded; press Edit. The Visual

Basic editor opens, and shows you the instructions you recorded. Near
the top there will likely be a Range("A1").Select command. You can
delete it, or enter an apostrophe before that command, which signals
the compiler to disregard that row.

Good luck with it!
Dave O
Eschew Obfuscation

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 149
Default Macro problems

Hi.

You would need to define your starting point as a variable, not a specific
cell.



"Father John" wrote:

Hi I am trying to record a simple macro where if I press alt+d the location
moves 7 "page down" key strokes - about 100 rows.
However when I record the macro it resorts back to the line number that my
macro originally ended up at 7 keystrokes from the top., even if I am 1500
lines down.
How can I resolve this?

With thanks
Stephen

(My apologies if this is duplicated as I cannot see the original post after
12 hours)

.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Macro problems

Sometimes, it's better to describe what you want to do.

For instance, if I want to select the cell after the last used cell in column A,
I'd use something like:

Dim NextCell as range
dim Wks as worksheet

with wks
set nextcell = .cells(.rows.count,"A").end(xlup).offset(1,0)
end with

nextcell.select

I like to start at the bottom of the worksheet and look upwards. Some look
downward from the cell. But if there are empty cells in the range, that may not
do what I want.



Father John wrote:

Hi I am trying to record a simple macro where if I press alt+d the location
moves 7 "page down" key strokes - about 100 rows.
However when I record the macro it resorts back to the line number that my
macro originally ended up at 7 keystrokes from the top., even if I am 1500
lines down.
How can I resolve this?

With thanks
Stephen

(My apologies if this is duplicated as I cannot see the original post after
12 hours)


--

Dave Peterson
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
Macro Problems laxnation87 Excel Discussion (Misc queries) 1 August 7th 07 05:41 PM
Problems with macro fieldsy73 Excel Discussion (Misc queries) 1 February 26th 07 03:04 AM
Macro problems Heine Excel Worksheet Functions 9 October 31st 06 11:01 AM
Macro Problems gillj Excel Discussion (Misc queries) 1 May 6th 06 11:51 AM
Macro problems Retta Excel Worksheet Functions 2 May 18th 05 10:39 PM


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