Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Consolidating Code

How can I consolidate the following code so that it improves execution time?
I recorded "scrolling" in my macro, and I'd like to consolidate every
discreet line/column scroll command.

ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
ActiveWindow.ScrollRow = 5
ActiveWindow.ScrollRow = 2
ActiveWindow.ScrollRow = 1

....so that it resembles something like this:
"ActiveWindow.ScrollColumn = 4:1"
"ActiveWindow.ScrollRow = 5:1"

Thanks you.
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default Consolidating Code

only the last command in each set counts

scrollcolumn automatically puts what ever column number you put as the
leftmost column, it is not a series of scrolls added together
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1

accomplishes the same exact thing as

activewindow.scrollcolumn = 1



"Excel User" wrote:

How can I consolidate the following code so that it improves execution time?
I recorded "scrolling" in my macro, and I'd like to consolidate every
discreet line/column scroll command.

ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
ActiveWindow.ScrollRow = 5
ActiveWindow.ScrollRow = 2
ActiveWindow.ScrollRow = 1

...so that it resembles something like this:
"ActiveWindow.ScrollColumn = 4:1"
"ActiveWindow.ScrollRow = 5:1"

Thanks you.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default Consolidating Code

Seeing as how all that code does it put you back at your original view,
why do you need the code at all?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Consolidating Code

Thanks - and good question: The page is a switchboard, and I want to keep it
"clean" and have the page reset with a selected cell out of view every time
it's unhidden.

"Chip" wrote:

Seeing as how all that code does it put you back at your original view,
why do you need the code at all?


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Consolidating Code

Thanks--I greatly appreciate your help.
Regards.
EU

"ben" wrote:

only the last command in each set counts

scrollcolumn automatically puts what ever column number you put as the
leftmost column, it is not a series of scrolls added together
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1

accomplishes the same exact thing as

activewindow.scrollcolumn = 1



"Excel User" wrote:

How can I consolidate the following code so that it improves execution time?
I recorded "scrolling" in my macro, and I'd like to consolidate every
discreet line/column scroll command.

ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
ActiveWindow.ScrollRow = 5
ActiveWindow.ScrollRow = 2
ActiveWindow.ScrollRow = 1

...so that it resembles something like this:
"ActiveWindow.ScrollColumn = 4:1"
"ActiveWindow.ScrollRow = 5:1"

Thanks you.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default Consolidating Code

I am not sure I understand your comment, so do you want the view to
reset on the selected cell? If so, use this:

Range("J1").Select
ActiveWindow.ScrollColumn = ActiveCell.Column
ActiveWindow.ScrollRow = ActiveCell.Row
With J1 being the Cell you want selected/viewed

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
Consolidating Data Gator Excel Worksheet Functions 4 September 20th 07 04:28 PM
consolidating workbooks chris confused Excel Worksheet Functions 2 July 14th 05 02:27 AM
Consolidating??? neil Excel Discussion (Misc queries) 1 February 14th 05 12:51 AM
Help with Mr. Dave Peterson's Code for Consolidating Many Sheets to One Rashid Khan Excel Programming 2 July 31st 04 07:31 PM
Consolidating module code Phil Hageman Excel Programming 6 August 15th 03 03:54 PM


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