+ Reply to Thread
Results 1 to 9 of 9

Getting macros to Select next column automaticaly

  1. #1
    Registered User
    Join Date
    05-04-2007
    Posts
    42

    Getting macros to Select next column automaticaly

    Hi I want to run "Text to Coulmns" on around 700 columns. How do I get VBA to do this. I can record the macro for one column but cannot get it to do multiple columns as below.

    Please Login or Register  to view this content.
    Last edited by phillb; 05-26-2011 at 03:32 AM.

  2. #2
    Forum Contributor johnjohns's Avatar
    Join Date
    11-19-2007
    Location
    Dubai, UAE
    MS-Off Ver
    2003 and 2007
    Posts
    526

    Re: Getting macros to Select next column automaticaly

    On 31st post please ensure that you are using code tags.
    regards

    johnjohns

    When you are not sure where to go, every road takes you there!

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Getting macros to Select next column automaticaly

    Hi philib,
    What John means is that you need to EDIT your post and then click on "Go Advanced". Select the code and click on the "#" icon above the message area. This will put code tags around the code so we can read it better.

    Now, after you do the above....

    Did you know that you can use numbers instead of letters for Columns()?

    Please Login or Register  to view this content.
    is the exact same as
    Please Login or Register  to view this content.
    Does that help? If you need to work through a bunch of columns how about a For Next Loop

    Please Login or Register  to view this content.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Registered User
    Join Date
    05-04-2007
    Posts
    42

    Re: Getting macros to Select next column automaticaly

    Hi Marvin,

    I have tried to alter the macro as suggested but don't think I am doing it right. I need to do columns 3 to 410.

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: Getting macros to Select next column automaticaly

    you forgot the for line:
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    05-04-2007
    Posts
    42

    Re: Getting macros to Select next column automaticaly

    Hi I have entered this, it does seem to highlight and scroll through all of the columns but it does not seem to be working. Could the ("c1") in line 4 be affecting it??

  7. #7
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: Getting macros to Select next column automaticaly

    yes it could you should replace it by
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    05-04-2007
    Posts
    42

    Re: Getting macros to Select next column automaticaly

    Sorry to be a pain. I have enteredthis and it comes up with "compile error: Argument not optional"

  9. #9
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: Getting macros to Select next column automaticaly

    sorry my mistake
    not
    Please Login or Register  to view this content.
    just
    Please Login or Register  to view this content.

+ 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