+ Reply to Thread
Results 1 to 6 of 6

Creating a Button That Clears A Merged Cell

Hybrid View

  1. #1
    Registered User
    Join Date
    01-19-2009
    Location
    Sydney
    MS-Off Ver
    Excel 2007
    Posts
    14

    Creating a Button That Clears A Merged Cell

    hello, Im creating a spreadsheet which will be used as a daily report for shift managers at my company. I have made a Macro to Reset (Clear) certain cells but one field is a merged cell. I get an error message saying that this operation cannot be performed on a Merged Cell, Is there anyway around this ?

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    The answer is, don't merge cells.

    If you search this forum for merged cells, you'll find one hundred other reasons not to.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    01-19-2009
    Location
    Sydney
    MS-Off Ver
    Excel 2007
    Posts
    14
    well its too late now

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello TroyDurham,

    If you post your workbook, I can help you with this.

    Sincerely,
    Leith Ross

  5. #5
    Registered User
    Join Date
    01-19-2009
    Location
    Sydney
    MS-Off Ver
    Excel 2007
    Posts
    14
    Its Attached
    Thanks
    Attached Files Attached Files

  6. #6
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    e.g.
    Sub Test()
        ClearContentsRange Worksheets("FrontPage").Range("D9")
    End Sub
    
    Sub ClearContentsRange(someRange As Range)
        Dim ma As Range, tf As Boolean
        With someRange
            Set ma = someRange.MergeArea
            If .MergeCells Then
                tf = True
                ma.UnMerge
                .ClearContents
            End If
            .ClearContents
        End With
        If tf Then ma.Merge
    End Sub

+ 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