+ Reply to Thread
Results 1 to 16 of 16

Delete entire row based on cell value in another sheet

  1. #1
    Registered User
    Join Date
    10-10-2014
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    54

    Exclamation Delete entire row based on cell value in another sheet

    SampleDelete.xlsx

    Hi, i need help in deleting the entire row in "Database" sheet based on the "Staff ID" entered in the "Entry" Sheet.
    Last edited by DespoExcel; 10-21-2014 at 11:55 PM. Reason: My Friend has helped me to solve it

  2. #2
    Valued Forum Contributor Kamboj's Avatar
    Join Date
    09-25-2014
    Location
    India
    MS-Off Ver
    2003 - 2010
    Posts
    430

    Re: Delete entire row based on cell value in another sheet

    USE THIS CODE IN MACRO
    ROW_1 = 1
    COL = 1 ' CHANGE THIS AS PER YOUR ID COLUMN
    ID = 10 'CHANGE THIS AS PER YOUR ID
    Do Until Cells(ROW_1, COL) = ""
    If Cells(ROW_1, COL).Value = ID Then
    Rows(ROW_1 & ":" & ROW_1).Delete
    End If
    ROW_1 = ROW_1 + 1
    Loop

  3. #3
    Registered User
    Join Date
    05-28-2013
    Location
    delhi
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Delete entire row based on cell value in another sheet

    Hi
    you can use this

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    05-28-2013
    Location
    delhi
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Delete entire row based on cell value in another sheet

    Cheers.

    Please Login or Register  to view this content.

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

    Re: Delete entire row based on cell value in another sheet

    Uhmm. Almost the same as Post#4.

    Please Login or Register  to view this content.
    But this is a Sheet Event Code.

  6. #6
    Registered User
    Join Date
    10-10-2014
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    54

    Re: Delete entire row based on cell value in another sheet

    Quote Originally Posted by prince141987 View Post
    Hi
    you can use this

    Please Login or Register  to view this content.
    I have tried, however, it shows an error. And when i debug, it highlighted the following bold coding

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    10-10-2014
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    54

    Re: Delete entire row based on cell value in another sheet

    Quote Originally Posted by prince141987 View Post
    Cheers.

    Please Login or Register  to view this content.
    I have tried, however, it shows an error. And when i debug, it highlighted the following bold coding
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    10-10-2014
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    54

    Re: Delete entire row based on cell value in another sheet

    Quote Originally Posted by JOHN H. DAVIS View Post
    Uhmm. Almost the same as Post#4.

    Please Login or Register  to view this content.
    But this is a Sheet Event Code.
    How am i suppose to make this event work? using the command button?

  9. #9
    Registered User
    Join Date
    10-10-2014
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    54

    Re: Delete entire row based on cell value in another sheet

    Quote Originally Posted by Kamboj View Post
    USE THIS CODE IN MACRO
    ROW_1 = 1
    COL = 1 ' CHANGE THIS AS PER YOUR ID COLUMN
    ID = 10 'CHANGE THIS AS PER YOUR ID
    Do Until Cells(ROW_1, COL) = ""
    If Cells(ROW_1, COL).Value = ID Then
    Rows(ROW_1 & ":" & ROW_1).Delete
    End If
    ROW_1 = ROW_1 + 1
    Loop
    It says that the macro is not defined.

  10. #10
    Forum Contributor
    Join Date
    08-29-2012
    Location
    Hyderbad
    MS-Off Ver
    Excel 2003
    Posts
    122

    Re: Delete entire row based on cell value in another sheet

    Hi DespoExcel,

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

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

    Re: Delete entire row based on cell value in another sheet

    Quote Originally Posted by DespoExcel View Post
    How am i suppose to make this event work? using the command button?
    Modified:

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    10-10-2014
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    54

    Re: Delete entire row based on cell value in another sheet

    Quote Originally Posted by jagadeesh.rt View Post
    Hi DespoExcel,

    Please this code :
    Please Login or Register  to view this content.
    I have tried but it seem like there is no response when i click the command button

  13. #13
    Registered User
    Join Date
    10-10-2014
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    54

    Re: Delete entire row based on cell value in another sheet

    Quote Originally Posted by JOHN H. DAVIS View Post
    Modified:

    Please Login or Register  to view this content.

    I have tried. The following coding that is bold is the result of the error - i debugged.

    Please Login or Register  to view this content.

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

    Re: Delete entire row based on cell value in another sheet

    Do you have an Actual Sheet named "Database"? Check the spelling.

  15. #15
    Registered User
    Join Date
    10-10-2014
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    54

    Re: Delete entire row based on cell value in another sheet

    Quote Originally Posted by JOHN H. DAVIS View Post
    Do you have an Actual Sheet named "Database"? Check the spelling.
    yes there is

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

    Re: Delete entire row based on cell value in another sheet

    Can you attach a sample with some dummy data where it doesn't do what you require? I will load and test.

+ 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] Formula to delete entire row based on cell value
    By vanitarathod in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-21-2014, 07:32 AM
  2. [SOLVED] Move entire row from one sheet to another based on cell value & delete the original row
    By ceciliacrawford in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-08-2014, 03:12 AM
  3. Macro to delete entire row based on cell contents
    By ATX in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 10-06-2011, 03:52 AM
  4. macro to delete entire row based on TWO cell values
    By uncleslinky in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-05-2011, 02:42 PM
  5. Replies: 2
    Last Post: 10-03-2005, 10:05 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