Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 9 of 9

Thread: Looping Macro choosing Columns

  1. #1
    Board Regular
    Join Date
    May 2002
    Posts
    59
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I have built many macros where I set a loop up to select rows. Since rows are numeric, the statement > Range("A" & Start & ":AQ" & Start).Select < works where Start is the loop counter.

    Today I ran into the need to select columns through a loop. I was trying to find how to do it using R1C1 commands, but was unable to. I know about the offset command, but that won't work in my case.

    I'd appreciate any help anyone can provide.

  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Christchurch New Zealand
    Posts
    1,030
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    what are you actually trying to do?

  3. #3
    Board Regular
    Join Date
    May 2002
    Posts
    59
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I'm trying to take the data in columns B to AE, copy it to another sheet (one column at at a time), sort it, delete blank rows, sort it back to original order, and then copy to a new sheet. I want to do a loop where I can select a specific column during each loop.

  4. #4
    Board Regular zacemmel's Avatar
    Join Date
    Apr 2002
    Location
    Redmond, WA
    Posts
    636
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    It is much easier if you use cells() instead of range(). Cells(row number, column number).

  5. #5
    Board Regular
    Join Date
    May 2002
    Posts
    59
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I've never used cells() before only range().select

    I'll look up cells in the help files.

    Any pointers you can give me in using cells()? Is a valid statement cells(r1c1).select?
    Thanks,
    Scott

  6. #6
    Board Regular
    Join Date
    May 2002
    Posts
    59
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    how do I select B1:B44 using a cells statement? I have only been successful with selecting B1 or B44 -> cells(2,1).select
    Thanks,
    Scott

  7. #7
    Board Regular
    Join Date
    Mar 2002
    Location
    England, UK.
    Posts
    526
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Range(Cells(1,2),Cells(44,2)).select


    [ This Message was edited by: RET79 on 2002-05-02 15:04 ]

  8. #8
    Board Regular
    Join Date
    May 2002
    Posts
    59
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    FANTASTIC! Thanks everyone for your help.
    Thanks,
    Scott

  9. #9
    Board Regular zacemmel's Avatar
    Join Date
    Apr 2002
    Location
    Redmond, WA
    Posts
    636
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    nevermind

    [ This Message was edited by: zacemmel on 2002-05-02 15:06 ]

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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