Results 1 to 15 of 15

Macro to check lenght of characters and merge cells

Threaded View

  1. #1
    Registered User
    Join Date
    11-21-2012
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    7

    Macro to check lenght of characters and merge cells

    Hello, guys!

    I am trying to do a macro that checks if the length of a row is more than 3 characters, if that's correct - merge that field with another 45 into a third one. However, I really got lost so I'd need your help. This is what I got so far.

    Sub MergeCells()
        Dim last As Long
        Dim   As Long
        Dim rangecells As Range
        Set rangecells = Range("M1:M100")
        Application.ScreenUpdating = False
        last = Cells(rangecells.Rows.Count, 1).End(xlUp).Row
        'loop
        For i = last To 1 Step -1
            If Len(Cells(i, 1)) > 3 Then
                ?????
                formatexpression = "=(M36&" "&N36&" "&O36&" "&P36&" "&Q36&" "&R36&" "&S36&" "&T36&" "&U36&" "&V36&" "&W36&" "&X36&" "&Y36&" "&Z36&" "&AA36&" "&AB36&" "&AC36&" "&AD36&" "&AE36&" "&AF36&" "&AG36&" "&AH36&" "&AI36&" "&AJ36&" "&AK36&" "&AL36&" "&AM36&" "&AN36&" "&AO36&" "&AP36&" "&AQ36&" "&AR36&" "&AS36&" "&AT36&" "&AU36&" "&AV36&" "&AW36&" "&AUX6)"
            End If
            Application.ScreenUpdating = True
        Next i
    End Sub
    Question is how can I specify these 45 rows to be merged with that "M1"?
    Got really lost...
    Attached Files Attached Files
    Last edited by hit1234; 04-08-2013 at 08:26 AM. Reason: Use code tags in future.

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