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


Is there a way to make a short statement for the two ranges of cell
being selected, K14 through A14, and A13 through A1?

Sub GoToA1()
' Scroll cursor to cell A1. Starting at K14 allows for
' cells that are part of "Freeze Pane."

Range("K14").Select
Range("J14").Select
Range("I14").Select
Range("H14").Select
Range("G14").Select
Range("F14").Select
Range("E14").Select
Range("D14").Select
Range("C14").Select
Range("B14").Select
Range("A14").Select

Range("A13").Select
Range("A12").Select
Range("A11").Select
Range("A10").Select
Range("A9").Select
Range("A8").Select
Range("A7").Select
Range("A6").Select
Range("A5").Select
Range("A4").Select
Range("A3").Select
Range("A2").Select
Range("A1").Select

End Su

--
P J
-----------------------------------------------------------------------
P J H's Profile: http://www.hightechtalks.com/m89
View this thread: http://www.hightechtalks.com/t235157

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Code Cleanup

Range("A1:A13,A14:K14").Select

--
Regards,
Tom Ogilvy


"P J H" wrote in message
...

Is there a way to make a short statement for the two ranges of cells
being selected, K14 through A14, and A13 through A1?

Sub GoToA1()
' Scroll cursor to cell A1. Starting at K14 allows for
' cells that are part of "Freeze Pane."

Range("K14").Select
Range("J14").Select
Range("I14").Select
Range("H14").Select
Range("G14").Select
Range("F14").Select
Range("E14").Select
Range("D14").Select
Range("C14").Select
Range("B14").Select
Range("A14").Select

Range("A13").Select
Range("A12").Select
Range("A11").Select
Range("A10").Select
Range("A9").Select
Range("A8").Select
Range("A7").Select
Range("A6").Select
Range("A5").Select
Range("A4").Select
Range("A3").Select
Range("A2").Select
Range("A1").Select

End Sub


--
P J H
------------------------------------------------------------------------
P J H's Profile: http://www.hightechtalks.com/m892
View this thread: http://www.hightechtalks.com/t2351575



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Code Cleanup

P J H,

Perhaps you want to pick up the upper left corner of the frozen pane? If so:

Cells(ActiveWindow.ActivePane.ScrollRow, _
ActiveWindow.ActivePane.ScrollColumn).Select

HTH,
Bernie
MS Excel MVP


"P J H" wrote in message
...

Is there a way to make a short statement for the two ranges of cells
being selected, K14 through A14, and A13 through A1?

Sub GoToA1()
' Scroll cursor to cell A1. Starting at K14 allows for
' cells that are part of "Freeze Pane."

Range("K14").Select
Range("J14").Select
Range("I14").Select
Range("H14").Select
Range("G14").Select
Range("F14").Select
Range("E14").Select
Range("D14").Select
Range("C14").Select
Range("B14").Select
Range("A14").Select

Range("A13").Select
Range("A12").Select
Range("A11").Select
Range("A10").Select
Range("A9").Select
Range("A8").Select
Range("A7").Select
Range("A6").Select
Range("A5").Select
Range("A4").Select
Range("A3").Select
Range("A2").Select
Range("A1").Select

End Sub


--
P J H
------------------------------------------------------------------------
P J H's Profile: http://www.hightechtalks.com/m892
View this thread: http://www.hightechtalks.com/t2351575



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
Code cleanup help peter.thompson[_63_] Excel Programming 4 January 22nd 06 04:49 AM
Code cleanup peter.thompson[_53_] Excel Programming 2 January 18th 06 06:16 AM
Code cleanup help please peter.thompson[_8_] Excel Programming 5 December 22nd 05 07:08 AM
Leo Heuser format cleanup code, and a question GatesAntichrist Excel Programming 3 July 2nd 04 04:18 AM
Source Data Code Cleanup Help John Michl[_2_] Excel Programming 2 August 18th 03 09:01 PM


All times are GMT +1. The time now is 09:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"