+ Reply to Thread
Results 1 to 6 of 6

Clearing cells using command button in different sheet

  1. #1
    Registered User
    Join Date
    09-17-2012
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    4

    Clearing cells using command button in different sheet

    Hi All,

    I have a commandbutton1 in sheet1 and I want to clear range of cells in sheet2. I'm using following commandbutton_click code,

    Please Login or Register  to view this content.
    Above code won't clear the cells I want. When I use for loop it works but it takes forever,

    Please Login or Register  to view this content.
    Is there a effective way of clearing cells in sheet 2?

    Thanks

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Clearing cells using command button in different sheet

    Please Login or Register  to view this content.
    Works fine for me...

    Maybe attach your workbook, so we can see what's going on.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Clearing cells using command button in different sheet

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Sheet2 and Sheets2 are not the same thing. Indexing (Sheet2) may be causing you an issue if the second sheet in the index is actually a different sheet than you want it to be. If your sheet has a static name is should be referenced that way.

  4. #4
    Registered User
    Join Date
    09-17-2012
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Clearing cells using command button in different sheet

    Thanks for the reply, here's the actual code I'm using where "Data" is my sheet2, But the command button is in Sheet1

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Clearing cells using command button in different sheet

    Run this independent macro to see if this clears it to where a blank message box pops up. If there is a value in the message box let me know if it is 1 value or 2.

    Please Login or Register  to view this content.
    Last edited by stnkynts; 07-14-2014 at 02:07 PM.

  6. #6
    Registered User
    Join Date
    09-17-2012
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Clearing cells using command button in different sheet

    Sorry for the delay. My initial code is working now. Thanks for all the replies.

+ 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. Transfering data from one sheet to a master sheet using Submit (command button)
    By readitdaily in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-02-2013, 09:15 AM
  2. How to create a command button to send specific cells out of an excel sheet..
    By meltelawi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-22-2013, 05:25 PM
  3. clearing a checkbox wth command button
    By shakey775 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-17-2012, 05:37 PM
  4. Clearing cells on another sheet
    By stoney1977 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-03-2007, 04:40 AM
  5. copy yellow cells on sheet 'quote to sheet1 via a command button
    By lokechoiwun in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-13-2006, 08:32 AM

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