+ Reply to Thread
Results 1 to 6 of 6

Clear the Specific Range of Cells Using a Command Button

  1. #1
    Registered User
    Join Date
    05-21-2014
    Posts
    19

    Clear the Specific Range of Cells Using a Command Button

    Hi All,

    I was trying to solve a small thing which i am unable to do.

    I am having a Excelbook With 4 sheets. I Inserted a Command button to clear the cells in Sheet 2. Now, I want to clear the Cell Content in Sheet3(From the Cell A5 to C(xldown)) also, using the same command button which is in Sheet2. i.e, if i click Clear Button from Sheet2 it should clear both Sheet2 values as well as Sheet 3 Values.

    Is it possible to delete the sheet3 contents? If yes, tell me how

    Thanks in Advance
    Abinaya

  2. #2
    Valued Forum Contributor adyteo's Avatar
    Join Date
    01-10-2013
    Location
    Calgary
    MS-Off Ver
    Excel 2010
    Posts
    540

    Re: Clear the Specific Range of Cells Using a Command Button

    Add this code to your existing code
    Please Login or Register  to view this content.
    Click on the star if you think I helped you

  3. #3
    Registered User
    Join Date
    05-21-2014
    Posts
    19

    Re: Clear the Specific Range of Cells Using a Command Button

    Hi Ady,

    Thanks for your help.

    I am getting error in the line "lngLastCell = Sheet("Sheet3").Range("A:C").Rows.Count"

    I have attached a sample file. Please see that.

    Regards,
    Abinaya..
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Re: Clear the Specific Range of Cells Using a Command Button

    Did you rename Sheet3?
    Last edited by Blokeman; 06-02-2014 at 04:57 AM.

  5. #5
    Registered User
    Join Date
    05-21-2014
    Posts
    19

    Re: Clear the Specific Range of Cells Using a Command Button

    Quote Originally Posted by Blokeman View Post
    Did you rename Sheet3?
    Yeah. i have renamed the sheet3. after that, i didn't get any error message. but the contents of cells from Sheet3 has not getting delete when i click on clear button.

    Could you please help me in this?

  6. #6
    Registered User
    Join Date
    05-21-2014
    Posts
    19

    Re: Clear the Specific Range of Cells Using a Command Button

    Hi all,

    I got it. I did few changes. Now it is working fine. Thank you so much guys.

+ 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. [b]clear specific or range of cells before macros' run[/b]
    By chergian in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-13-2014, 11:21 PM
  2. Using two form combobox selections to jump to specific cells using command button
    By bberger1985 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-30-2013, 05:52 PM
  3. [SOLVED] how to stop Command button If specific number is entered in a specific cell range
    By sspreyer in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-26-2013, 05:10 AM
  4. 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
  5. command button that puts specific numbers in a range of cells
    By ko6ad in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-28-2006, 01:41 PM

Tags for this Thread

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