+ Reply to Thread
Results 1 to 4 of 4

Merge cells with same value, old code needs rework.

  1. #1
    Registered User
    Join Date
    06-17-2014
    Location
    Uppsala, Sweden
    MS-Off Ver
    2010
    Posts
    43

    Merge cells with same value, old code needs rework.

    I tried to post in an old thread about a similar problem, but it was a 2 year old thread so I guess no one saw it.

    However, this code merges all weeks that have the same weeknumber into one cell. The weeknumbers are listed in a column.
    The code comes from arlu1201 and works perfectly for the matter where the weeknumbers are listed in a column and thus the cells in each row merge.

    Please Login or Register  to view this content.
    So my problem is that I have the weeknumbers listen in a row instead. (see ex.) I am not good at all with VBA and I wonder if the code can be rewritten to work for merging of columns instead.

    Link to the old thread: http://www.excelforum.com/excel-gene...ml#post3738416

    Thanks in advance.
    Attached Files Attached Files
    Last edited by johansoder; 06-23-2014 at 09:15 AM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Merge cells with same value, old code needs rework.

    Hi,

    Can I respectfully suggest that you don't use merged cells - at least if they are to be used as the subject cells in formulae. Even if you want to see them as merged cells, then at least also have a row containing the week numbers in every cell and just hide that row if you don't want to see it.

    Merged cells are just too much trouble and invariably cause problems.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    06-17-2014
    Location
    Uppsala, Sweden
    MS-Off Ver
    2010
    Posts
    43

    Re: Merge cells with same value, old code needs rework.

    Hi,

    I understand what you mean and how they can be a problem. In this case however I need to distinctly see what week it is without alot of numbers (read weeknumber for each day) and without hiding rows and such. They are also not going to be used in any formulas, this macro will be entered once at the beginning of the use of this document. Hence, it should be safe.

    That beeing said, do you have any ideas how to rewrite the code?

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

    Re: Merge cells with same value, old code needs rework.

    try this
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-17-2014
    Location
    Uppsala, Sweden
    MS-Off Ver
    2010
    Posts
    43

    Re: Merge cells with same value, old code needs rework.

    Thanks Nilem, worked perfectly!
    Will give rep, cheers.

  6. #6
    Registered User
    Join Date
    06-17-2014
    Location
    Uppsala, Sweden
    MS-Off Ver
    2010
    Posts
    43

    Re: Merge cells with same value, old code needs rework.

    Thanks Nilem, worked perfectly!
    Will give rep, cheers.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VB Code to un-merge cells
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-12-2013, 05:39 PM
  2. [SOLVED] Rework in vba code to refresh sum value.
    By satputenandkumar0 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-15-2013, 02:54 AM
  3. VBA code to Merge the repeated cells and sum the corresponding columns
    By kiran234 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-15-2010, 07:58 PM
  4. how do i rework the sequence of data
    By ranjan in forum Excel General
    Replies: 3
    Last Post: 05-08-2007, 09:11 AM
  5. How to merge cells in Word document by VBA code??
    By SiriS in forum Excel General
    Replies: 0
    Last Post: 05-04-2006, 07:03 AM

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