+ Reply to Thread
Results 1 to 6 of 6

Can I turn off the Excel warning about cell merging?

  1. #1
    Registered User
    Join Date
    08-27-2007
    Posts
    48

    Can I turn off the Excel warning about cell merging?

    Hi,

    My excel workbook uses VBA to generate output by formatting and writing to a worksheet. Part of the formatting involves merging cells. This happens quite a few times.

    When it happens, the following warning is shown: "The selection contains multiple data values. Merging into one sell will keep the upper-left most data only." This warning occurs multiple times and is annoying.
    Is there any way of turning it off?

    Lotte

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,552
    try
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-27-2007
    Posts
    48
    Hi Jindon,

    Thanks very much!

    Do you know of a web site which lists all the application.... functions with an explanation of what they do?

    Cheers,
    Lotte

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,552
    See object browser in vbe...

  5. #5
    Registered User
    Join Date
    11-01-2013
    Location
    hyderabad
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Can I turn off the Excel warning about cell merging?

    Hi Jindon,

    I am getting the warning, please look into my macro below and can you help me...

    Sub Merge()
    Range("A2").Select
    Range(Selection, Selection.End(xlDown)).Select

    Do

    With Selection
    .HorizontalAlignment = xlCenter
    .VerticalAlignment = xlCenter
    .WrapText = False
    .Orientation = 0
    .AddIndent = False
    .IndentLevel = 0
    .ShrinkToFit = False
    .ReadingOrder = xlContext
    .MergeCells = False
    End With
    Selection.Merge
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone

    Application.DisplayAlerts = False
    ' your cell merge code here
    Application.DisplayAlerts = True

    With Selection.Borders(xlEdgeLeft)
    .LineStyle = xlContinuous
    .ColorIndex = 0
    .TintAndShade = 0
    .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeTop)
    .LineStyle = xlContinuous
    .ColorIndex = 0
    .TintAndShade = 0
    .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeBottom)
    .LineStyle = xlContinuous
    .ColorIndex = 0
    .TintAndShade = 0
    .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeRight)
    .LineStyle = xlContinuous
    .ColorIndex = 0
    .TintAndShade = 0
    .Weight = xlThin
    End With
    With Selection.Borders(xlInsideVertical)
    .LineStyle = xlContinuous
    .ColorIndex = 0
    .TintAndShade = 0
    .Weight = xlThin
    End With
    With Selection.Borders(xlInsideHorizontal)
    .LineStyle = xlContinuous
    .ColorIndex = 0
    .TintAndShade = 0
    .Weight = xlThin
    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 = xlBottom
    .WrapText = False
    .Orientation = 0
    .AddIndent = False
    .IndentLevel = 0
    .ShrinkToFit = False
    .ReadingOrder = xlContext
    .MergeCells = True
    End With
    With Selection
    .HorizontalAlignment = xlCenter
    .VerticalAlignment = xlBottom
    .WrapText = False
    .Orientation = 0
    .AddIndent = False
    .IndentLevel = 0
    .ShrinkToFit = False
    .ReadingOrder = xlContext
    .MergeCells = True
    End With
    With Selection
    .HorizontalAlignment = xlCenter
    .VerticalAlignment = xlCenter
    .WrapText = False
    .Orientation = 0
    .AddIndent = False
    .IndentLevel = 0
    .ShrinkToFit = False
    .ReadingOrder = xlContext
    .MergeCells = True
    End With
    Columns("A:A").EntireColumn.AutoFit
    Selection.FillDown

    Selection.End(xlDown).Select
    Range(Selection, Selection.End(xlDown)).Select

    Loop Until IsEmpty(ActiveCell.Value)

    Range("A1").Select

    End Sub

    Tejavan

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,552

    Re: Can I turn off the Excel warning about cell merging?

    tejakumar9

    1) Please wrap the vba code with code tag
    [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code]

    2) You need to open a new thread for your own question by the rule here.

+ 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