+ Reply to Thread
Results 1 to 4 of 4

Code Cleanup

  1. #1
    P J H
    Guest

    Code Cleanup


    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


  2. #2
    Don Guillett
    Guest

    Re: Code Cleanup

    try this
    range("b14:k14")
    or
    range("b14,d14,k14")

    --
    Don Guillett
    SalesAid Software
    [email protected]
    "P J H" <[email protected]> wrote in message
    news:[email protected]...
    >
    > 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
    >




  3. #3
    Tom Ogilvy
    Guest

    Re: Code Cleanup

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

    --
    Regards,
    Tom Ogilvy


    "P J H" <[email protected]> wrote in message
    news:[email protected]...
    >
    > 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. #4
    Bernie Deitrick
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    >
    > 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1