+ Reply to Thread
Results 1 to 3 of 3

VBA Programming a Macro (involving merging cells in Excel 2007)

  1. #1
    Registered User
    Join Date
    06-14-2012
    Location
    CA
    MS-Off Ver
    Excel 2007
    Posts
    26

    VBA Programming a Macro (involving merging cells in Excel 2007)

    Hi,
    I'm wondering if there's a way to program a macro, so that when the cells are merged and when it runs, it doesn't prompt the user to acknowledge that the cells are merging, and that it just runs automatically? Here's some code I'm using to give a better idea.

    Range("A2:B2").Select
    With Selection
    .HorizontalAlignment = xlCenter
    .VerticalAlignment = xlBottom
    .WrapText = True
    .Orientation = 0
    .AddIndent = False
    .IndentLevel = 0
    .ShrinkToFit = False
    .ReadingOrder = xlContext
    .MergeCells = False
    End With
    Selection.Merge

    I've also tried making a small edit like this:

    Range("A2:B2").Select
    With Selection
    .HorizontalAlignment = xlCenter
    .VerticalAlignment = xlBottom
    .WrapText = True
    .Orientation = 0
    .AddIndent = False
    .IndentLevel = 0
    .ShrinkToFit = False
    .ReadingOrder = xlContext
    .MergeCells = True
    End With

    but the result is that the user is still prompted to acknowledge the cell merge. Is there a way to avoid having the user respond and just run automatically? Thanks for your help!

  2. #2
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: VBA Programming a Macro (involving merging cells in Excel 2007)

    hi try this
    Please Login or Register  to view this content.
    Regards

    tom1977

    If You are satisfied with my solution click the small star icon on the left to say thanks.

  3. #3
    Registered User
    Join Date
    06-14-2012
    Location
    CA
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: VBA Programming a Macro (involving merging cells in Excel 2007)

    Thanks for your help! It worked.

+ 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