+ Reply to Thread
Results 1 to 4 of 4

Loop Command to unmerge existing merge cells

Hybrid View

  1. #1
    Registered User
    Join Date
    06-26-2010
    Location
    Abu Dhabi, UAE
    MS-Off Ver
    Excel 2003
    Posts
    7

    Loop Command to unmerge existing merge cells

    hello guys,

    i have this macro generated command which is very long and when run will pop-up an error which is it is too long to compile. if i'm right, this can be done through looping command. can anyone help how to make this into a looping command?

    thank you!


    Sheets("1").Select
    Range("A11:C191").Select
    With Selection
    .HorizontalAlignment = xlGeneral
    .VerticalAlignment = xlCenter
    .WrapText = False
    .Orientation = 0
    .AddIndent = False
    .IndentLevel = 0
    .ShrinkToFit = False
    .ReadingOrder = xlContext
    .MergeCells = True
    End With
    With Selection
    .HorizontalAlignment = xlGeneral
    .VerticalAlignment = xlCenter
    .WrapText = False
    .Orientation = 0
    .AddIndent = False
    .IndentLevel = 0
    .ShrinkToFit = False
    .ReadingOrder = xlContext
    .MergeCells = True
    End With
    With Selection
    .HorizontalAlignment = xlGeneral
    .VerticalAlignment = xlCenter
    .WrapText = False
    .Orientation = 0
    .AddIndent = False
    .IndentLevel = 0
    .ShrinkToFit = False
    .ReadingOrder = xlContext
    .MergeCells = True
    End With
    With Selection
    .HorizontalAlignment = xlGeneral
    .VerticalAlignment = xlCenter
    .WrapText = False
    .Orientation = 0
    .AddIndent = False
    .IndentLevel = 0
    .ShrinkToFit = False
    .ReadingOrder = xlContext
    .MergeCells = True

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Loop Command to unmerge existing merge cells

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    06-26-2010
    Location
    Abu Dhabi, UAE
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Loop Command to unmerge existing merge cells

    Quote Originally Posted by ahlecks View Post
    hello guys,

    i have this macro generated command which is very long and when run will pop-up an error which is it is too long to compile. if i'm right, this can be done through looping command. can anyone help how to make this into a looping command?

    thank you!


    [b] Sheets("1").Select [b]
    [b] Range("A11:C191").Select [b]
    [b] With Selection[b]
    [b] .HorizontalAlignment = xlGeneral[b]
    [b] .VerticalAlignment = xlCenter[b]
    [b] .WrapText = False[b]
    [b] .Orientation = 0[b]
    [b] .AddIndent = False[b]
    [b] .IndentLevel = 0[b]
    [b] .ShrinkToFit = False[b]
    [b] .ReadingOrder = xlContext[b]
    [b] .MergeCells = True[b]
    [b] End With[b]
    [b] With Selection[b]
    [b] .HorizontalAlignment = xlGeneral[b]
    [b] .VerticalAlignment = xlCenter[b]
    [b] .WrapText = False[b]
    [b] .Orientation = 0[b]
    [b] .AddIndent = False[b]
    [b] .IndentLevel = 0[b]
    [b] .ShrinkToFit = False[b]
    [b] .ReadingOrder = xlContext[b]
    [b] .MergeCells = True[b]
    [b] End With[b]
    [b] With Selection[b]
    [b] .HorizontalAlignment = xlGeneral[b]
    [b] .VerticalAlignment = xlCenter[b]
    [b] .WrapText = False[b]
    [b] .Orientation = 0[b]
    [b] .AddIndent = False[b]
    [b] .IndentLevel = 0[b]
    [b] .ShrinkToFit = False[b]
    [b] .ReadingOrder = xlContext[b]
    [b] .MergeCells = True[b]
    [b] End With[b]
    [b] With Selection[b]
    [b] .HorizontalAlignment = xlGeneral[b]
    [b] .VerticalAlignment = xlCenter[b]
    [b] .WrapText = False[b]
    [b] .Orientation = 0[b]
    [b] .AddIndent = False[b]
    [b] .IndentLevel = 0[b]
    [b] .ShrinkToFit = False[b]
    [b] .ReadingOrder = xlContext[b]
    [b] .MergeCells = True
    [b]

    i dunno if i did this right...

  4. #4
    Registered User
    Join Date
    06-26-2010
    Location
    Abu Dhabi, UAE
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Loop Command to unmerge existing merge cells

    Quote Originally Posted by ahlecks View Post
    hello guys,

    i have this macro generated command which is very long and when run will pop-up an error which is it is too long to compile. if i'm right, this can be done through looping command. can anyone help how to make this into a looping command?

    thank you!


    Sheets("1").Select
    Range("A11:C191").Select
    With Selection
    .HorizontalAlignment = xlGeneral
    .VerticalAlignment = xlCenter
    .WrapText = False
    .Orientation = 0
    .AddIndent = False
    .IndentLevel = 0
    .ShrinkToFit = False
    .ReadingOrder = xlContext
    .MergeCells = True
    End With
    With Selection
    .HorizontalAlignment = xlGeneral
    .VerticalAlignment = xlCenter
    .WrapText = False
    .Orientation = 0
    .AddIndent = False
    .IndentLevel = 0
    .ShrinkToFit = False
    .ReadingOrder = xlContext
    .MergeCells = True
    End With
    With Selection
    .HorizontalAlignment = xlGeneral
    .VerticalAlignment = xlCenter
    .WrapText = False
    .Orientation = 0
    .AddIndent = False
    .IndentLevel = 0
    .ShrinkToFit = False
    .ReadingOrder = xlContext
    .MergeCells = True
    End With
    With Selection
    .HorizontalAlignment = xlGeneral
    .VerticalAlignment = xlCenter
    .WrapText = False
    .Orientation = 0
    .AddIndent = False
    .IndentLevel = 0
    .ShrinkToFit = False
    .ReadingOrder = xlContext
    .MergeCells = True
    Sheets("1").Select
    Range("A11:C191").Select
    With Selection
    .HorizontalAlignment = xlGeneral
    .VerticalAlignment = xlCenter
    .WrapText = False
    .Orientation = 0
    .AddIndent = False
    .IndentLevel = 0
    .ShrinkToFit = False
    .ReadingOrder = xlContext
    .MergeCells = True
    End With
    With Selection
    .HorizontalAlignment = xlGeneral
    .VerticalAlignment = xlCenter
    .WrapText = False
    .Orientation = 0
    .AddIndent = False
    .IndentLevel = 0
    .ShrinkToFit = False
    .ReadingOrder = xlContext
    .MergeCells = True
    End With
    With Selection
    .HorizontalAlignment = xlGeneral
    .VerticalAlignment = xlCenter
    .WrapText = False
    .Orientation = 0
    .AddIndent = False
    .IndentLevel = 0
    .ShrinkToFit = False
    .ReadingOrder = xlContext
    .MergeCells = True
    End With
    With Selection
    .HorizontalAlignment = xlGeneral
    .VerticalAlignment = xlCenter
    .WrapText = False
    .Orientation = 0
    .AddIndent = False
    .IndentLevel = 0
    .ShrinkToFit = False
    .ReadingOrder = xlContext
    .MergeCells = True

+ 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