Results 1 to 11 of 11

Smart Merging

Threaded View

  1. #1
    Forum Contributor
    Join Date
    02-24-2010
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    195

    Smile Smart Merging

    I'm trying to right a piece of code that merge the contents of 'column B'
    were the contents of 'column A' is repeated.

    I've attached my code below but unfortunately the Offset by one action does not work for me as there can be varios numbers of cells with the sage info.

    I've attached an example dats/result set.

    Sub Test()
    Dim Cell As Range
    For Each Cell In ActiveSheet.UsedRange
    'Horizontal
        'If Cell = Cell.Offset(0, 1) And Cell <> "" Then
         '   Cell.Offset(0, 1).ClearContents
          '  Range(Cell, Cell.Offset(0, 1)).Merge
        'End If
    'Vertical
        If Cell = Cell.Offset(1, 0) And Cell <> "" Then
            Cell.Offset(1, 0).ClearContents
            Range(Cell, Cell.Offset(1, 0)).Merge
        End If
        
    Next Cell
    End Sub
    Attached Files Attached Files
    Last edited by TonyforVBA; 10-07-2011 at 11:48 AM.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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