+ Reply to Thread
Results 1 to 4 of 4

Clear Contents Macro for Merge Cell (Compile error : Expected End Sub)

  1. #1
    Forum Contributor
    Join Date
    11-29-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    106

    Clear Contents Macro for Merge Cell (Compile error : Expected End Sub)

    Hi everybody :-)

    I'm trying to use the "clear contents macro" for merge cell,
    but I keep receiving this "compile error : Expected End Sub" error.

    FYI, I have named my merge cells to "myMergedCells"

    Thank you in advance :-)

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    03-21-2012
    Location
    Ho Chi Minh city
    MS-Off Ver
    Excel 2003
    Posts
    180

    Re: Clear Contents Macro for Merge Cell (Compile error : Expected End Sub)

    PHP Code: 
    Private Sub CommandButton4_Click()

    End Sub    '<=|'

    Sub ClearMerged()
    'Loop through Named Range, clearing contents'
       
    For Each m_cell In Range("myMergedCells")
          
    m_cell.MergeArea.ClearContents
       Next
    End Sub 

  3. #3
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: Clear Contents Macro for Merge Cell (Compile error : Expected End Sub)

    Hi namialus,

    You need to comment out or delete this line of code...

    Please Login or Register  to view this content.
    ...as the macro is already being called via the clicking of Button4.

    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  4. #4
    Forum Contributor
    Join Date
    11-29-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    106

    Re: Clear Contents Macro for Merge Cell (Compile error : Expected End Sub)

    Thank you guys,

    Both formula can work :-)

    Thanks again

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro Compile error: Expected End With
    By hotwax in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-07-2014, 04:58 PM
  2. Compile Error: Expected End With
    By Robert110 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-14-2013, 07:14 AM
  3. Compile Error: Expected End With?
    By Jeka__7 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-27-2013, 10:30 AM
  4. VBA Compile Error: Expected End With
    By MLS Packer Lover in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-24-2011, 02:58 AM
  5. compile error: Expected: = ...Why?
    By cesw in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-09-2005, 08:05 PM

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