+ Reply to Thread
Results 1 to 4 of 4

Merge cells that a loop references

  1. #1
    Registered User
    Join Date
    08-02-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    2

    Unhappy Merge cells that a loop references

    VBA knowledge is limited.

    I have a macro where there is a loop and starts a one row & goes back till first row, which may encompass several rows. Each cell gets a some borders formatted to it individually.

    I want to be able to select all rows in the loop incl of the start and finish rows and merge!

    Can anyone help?

    this is the part of the macro in question & obviously you cant merge individual cells.

    'update counter
    Vlength = Vlength - 1
    Loop Until Vlength = 0
    Application.CutCopyMode = False
    ActiveCell.Value = Vdesc


    Application.CutCopyMode = False
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
    .LineStyle = xlContinuous
    .Weight = xlThin
    .ColorIndex = xlAutomatic
    End With
    Selection.Borders(xlEdgeBottom).LineStyle = xlNone
    With Selection.Borders(xlEdgeTop)
    .LineStyle = xlContinuous
    .Weight = xlThin
    .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeRight)
    .LineStyle = xlContinuous
    .Weight = xlThin
    .ColorIndex = xlAutomatic
    End With
    Selection.Borders(xlInsideHorizontal).LineStyle = xlNone

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Help please, trying to merge cells that a loop references

    attach please a sample file with current data and desired result
    If solved remember to mark Thread as solved

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Help please, trying to merge cells that a loop references

    Hi, rjwrees,

    weŽd love to help but sadly you missed to wrap your code in code-tags as requested in the forum rules. WeŽd be glad to help if you do so.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Registered User
    Join Date
    08-02-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Help please, trying to merge cells that a loop references

    Quote Originally Posted by patel45 View Post
    attach please a sample file with current data and desired result
    Hi,

    Having trouble attaching sheet.

    Essentially, during the following Loop, that goes from one row to another, I want to be able to select all rows that the loop goes through and at the end of the loop Merge the cells.

    Hope that makes sense.

    Richard

    'update counter
    Vlength = Vlength - 1
    Loop Until Vlength = 0
    Application.CutCopyMode = False
    ActiveCell.Value = Vdesc


    Application.CutCopyMode = False

+ 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. [SOLVED] Merge Cells in Dynamic Range using For loop
    By crazymazy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-01-2013, 11:33 AM
  2. Macro to merge cells based on cell references
    By ajm123456789 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-31-2012, 05:20 PM
  3. Macro to merge cells based on cell references
    By ajm123456789 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-17-2012, 03:38 PM
  4. [SOLVED] Loop through column and merge cells
    By christensen in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-10-2012, 04:17 AM
  5. A loop to merge cells based on a value
    By tschultz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-24-2005, 02:50 PM

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