+ Reply to Thread
Results 1 to 15 of 15

Move to next column after sort

  1. #1
    Registered User
    Join Date
    03-24-2007
    Posts
    88

    Move to next column after sort

    Could anyone please tell me the formula that I will need in my macro to move to the next column (up one letter) for the next time I run the macro witout me having to manually change column the letter?

    Thanks Nunzio

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    If you explained what you are doing you would get a more accurate answer.

    You could try

    To move to the next cell
    Please Login or Register  to view this content.
    or to select the next column
    Please Login or Register  to view this content.
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    03-24-2007
    Posts
    88
    Here is my macro, after the macro is completed I would like it to go to next column which in this case would J and K etc. Move up one column each time it is run. There are three separate ranges for the current column I.

    Please Login or Register  to view this content.
    Last edited by VBA Noob; 03-24-2007 at 04:24 PM.

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Please read forum rules below and then wrap yor code

    VBA Noob

  5. #5
    Registered User
    Join Date
    03-24-2007
    Posts
    88

    wrap text

    I am sorry I don't understand

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Read the link.

    you basically enter [code]at the start of thr code and then [code] at the end. However the last [code] has and / between the [ and the letter c.

    or when composing your post you can you use the # symbol on the toolbar

    VBA Noob

  7. #7
    Registered User
    Join Date
    03-24-2007
    Posts
    88

    #

    Is this ok?


    Please Login or Register  to view this content.

  8. #8
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Yes. Thank you

    I think this might work

    Please Login or Register  to view this content.
    VBA Noob

  9. #9
    Registered User
    Join Date
    03-24-2007
    Posts
    88

    Macro

    Thanks but I could not get it to work. Starting in column d I need to move one column at a time all the way to ak.

    Thanks Nunzio

  10. #10
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    What happened ??

    If it's just the wrong columns then amended

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    VBA Noob

  11. #11
    Registered User
    Join Date
    03-24-2007
    Posts
    88

    macro

    Ok were getting somewhere the macro is running now but what I need to to do start in column 4 which is a fiscal week read it and stop and than the next time I run it read column 5 which is the next fiscal week and stop etc.

    Thanks Rick

  12. #12
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Nunzio

    VBA Noob has asked me to provide some assistance to your problem

    I assume by your discription you will be running the macro weekly.

    To keep track of what column that the macro last used the macro will need to store the column number. The easiest way to do this is in a cell of a spreadsheet. Is there a cell on an existing sheet that the macro can use or is it possible to add another sheet that the macro can use.

    Another option is if the macro is being run weekly or some other regular interval the macro could be coded to calculate the column number base on the date it was run. would need to know the date that column 4 was for.
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  13. #13
    Registered User
    Join Date
    03-24-2007
    Posts
    88

    Mudraker

    Sure row # 1 is available in each column.
    Thanks Nunzio

  14. #14
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Try this modification

    I have coded it to use ak1 to track last used column number. if ak1 is blank or less than 4 macro will start at column 4. if value in ak1 is greater than 3 it adds 1 to the value in ak1 and uses that value.

    After macro has run it updates entry in AK1

    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    03-24-2007
    Posts
    88

    Mudraker & VBA Noob

    I just wanted to thank you guy's very much your the best and very smart at that.

    Nunzio

+ 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