Recording a Macro-can I stop the Active window info from recording

P

Pennyc

When I'm recording a Macro in Excel, I end up with lots and lots of lines
that say something like "ActiveWindow.ScrollRow = 260" with one line for
every 6-20 lines that I'm scrolling up or down in the worksheet. This just
seems to be useless information that's cluttering up the "meat" of the Macro.
I've gone back and deleted all of these lines without affecting the operation
of the Macro, but I'd like to find out if there is a way to have that
information not record in the first place. Can anyone help? Unfortunately,
my skill level at this time means that I'm doing a lot of recording instead
of writing of macros.

Thanks!
 
R

ryguy7272

For now, keep deleting those lines! Read the posts on this site, and try
them yourself, with the sample data that posters (almost) always provide.
Also, but a good Excel VBA programming book. here are a couple that are
worth their weight in gold:

For Excel 2007:
Excel 2007 Power Programming with VBA (Mr. Spreadsheet's Bookshelf)
(Paperback)
# ISBN-10: 0470044012
# ISBN-13: 978-0470044018

For excel 2003:
Excel 2003 Power Programming with VBA (Excel Power Programming With Vba)
(Paperback)
# ISBN-10: 0764540726
# ISBN-13: 978-0764540721


Also, practice, practice, practice; this is the BEST way to learn programming.

HTH,
Ryan---
 
J

JLGWhiz

The recorder will emulate each manual move that you make. Many of the moves
are unnecessary for VBA to execute the program and produce the results that
you need. What I would suggest is that you go through and comment out (
' ) the lines that you think can be deleted first. By putting the
apostrophe in front of a line, it prevents execution of that line. If your
recorded macro then works as you want it to, go ahead and delete the lines
with the comment symbol. You can also reduce the amount of code by removing
the Select and Selection entries for most lines. For example:

Range("A1").Select
Selection.Font.Bold = True

Can be written as:

Range("A1").Font.Bold = True

This also cuts down on the flicker and flash while the code runs.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top