+ Reply to Thread
Results 1 to 8 of 8

VBA Looping Issue_Merging Alternating Columns

  1. #1
    Registered User
    Join Date
    07-26-2012
    Location
    Stanford, CA
    MS-Off Ver
    Excel 2010
    Posts
    8

    VBA Looping Issue_Merging Alternating Columns

    Hi All,

    I am new to writing macros in excel, and I am having trouble writing a macro to merge alternating columns in excel 2010.

    My code is below, and a sample worksheet attached. The problem I am having is the macro will only merge the first column offset 1 from the active cell. It will not continue to the 3rd, 5th, etc.

    Is there any way I can create a command that increases my offset numbers by a given value, in this case two? I can do this manually, but I am sure there must be a way to do this quickly within VBA.


    Thanks for the help!

    Best,
    Mark

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Cutter; 07-26-2012 at 08:17 PM. Reason: Added code tags

  2. #2
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: VBA Looping Issue_Merging Alternating Columns

    Hi Mark, try it
    Please Login or Register  to view this content.
    or
    Please Login or Register  to view this content.
    And please use code tags for code in your posts.

  3. #3
    Registered User
    Join Date
    07-26-2012
    Location
    Stanford, CA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: VBA Looping Issue_Merging Alternating Columns

    Hi Nilem,

    I tried each macro in my sample workbook and the code simply hid all the columns that I had data in.

    Also, sorry for not using tags, what are those exactly?

  4. #4
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: VBA Looping Issue_Merging Alternating Columns

    You need not hide the columns, but something else? Show the desired result in your file.

  5. #5
    Registered User
    Join Date
    07-26-2012
    Location
    Stanford, CA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: VBA Looping Issue_Merging Alternating Columns

    The desired result is illustrated in the file labeled "Example updated"

    Thanks again for the help.
    Attached Files Attached Files

  6. #6
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: VBA Looping Issue_Merging Alternating Columns

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    07-26-2012
    Location
    Stanford, CA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: VBA Looping Issue_Merging Alternating Columns

    Work's perfectly. Thank you!

  8. #8
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: VBA Looping Issue_Merging Alternating Columns

    @ markp5

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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