+ Reply to Thread
Results 1 to 9 of 9

How to delete a row using a command button

  1. #1
    Registered User
    Join Date
    10-10-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    49

    How to delete a row using a command button

    Hi all,

    I know that this may seem a little strange to request as you can just select the row and delete it, however the sheet is designed as "idiot proof", so I would like to implement this.

    Basically, I have a box which states "If you need to delete a row due to incorrect entry, please type the row number here (next cell), and click delete".

    I want to know if by using VBA, you can reference the number entered in the cell, and use this to determin the row in which we are required to delete.

    Being that I am still learning VBA, a coding example would be very helpful if anyone has it.

    Many thanks,

    Andy.

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: How to delete a row using a command button

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-10-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: How to delete a row using a command button

    Hi John,

    Thank you for the response. I appreciate that this may make total sense, however I am a total novice to this.

    All I have is an empty cell which I would expect users to enter the row number. Do I need to create a text box or something for them to enter this number into?

    My thoughts are have an empty cell for the user to enter the row number in, then next to that a command box which says "Delete".

    If this in not the way, please could you advise what is required in order to make this work?

    Many thanks in advance!

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: How to delete a row using a command button

    What is sheet is the empty cell in and what is the cell address?

  5. #5
    Registered User
    Join Date
    10-10-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: How to delete a row using a command button

    Currently I just have the sheet as Sheet3.

    I would like them to enter the row number which they would like to delete into cell J6. I then have a command box next to that cell which says Delete which I would like to attach the code to ("click button") so once they enter the row number they click and the entered row number will be deleted.

    Hope this is what you were after?

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: How to delete a row using a command button

    Maybe:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    10-10-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: How to delete a row using a command button

    Do I Alt F11 and enter this as a Module, or enter it onto the This Worksheet page?

  8. #8
    Registered User
    Join Date
    10-10-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: How to delete a row using a command button

    Dont worry, I got it.

    Thank you very much for your help!!!

  9. #9
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: How to delete a row using a command button

    You're welcome. Glad to help out and thanks for the feedback.

+ 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. [SOLVED] Delete a VBA Command Button after run?
    By NicksDad in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-18-2013, 10:27 AM
  2. delete from text box using command button
    By john tempest in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-31-2006, 03:25 AM
  3. [SOLVED] Delete command button ?
    By SpookiePower in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-23-2006, 10:55 AM
  4. [SOLVED] Delete a command button via VBA
    By Brian K. Sheperd in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-08-2005, 11:05 AM
  5. Delete with command button?
    By John in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-17-2005, 10:06 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