Results 1 to 4 of 4

VBA Code to Delete Rows of Data if Cells Contain the Same Value From Another Sheet

Threaded View

  1. #1
    Registered User
    Join Date
    05-30-2014
    Posts
    17

    VBA Code to Delete Rows of Data if Cells Contain the Same Value From Another Sheet

    Hello,

    I am new to VBA and will like to seek help in writing a macro.
    I have got a set of data in a workbook with Sheet 1 range A1 to K373 and a range of data in Sheet 2 ranging from A1 to A30. What I will like to do is to have a VBA code to loop through all the cells in Sheet 1 column C and check which are the cells which value matches those in Sheet 2. Those that matches in Sheet 1 will have the entire row deleted. I have come out with the following codes but it does not work and hope to have someone here to guide me through.

    Sub Test()
    Dim intcounter As Integer
    Dim y As String
    intcounter = 1
    Set y = Worksheets("Sheet2").Ranges("A1:A30")
    For intcounter = 2 To 373
    If Cells(intcounter, 3).Value = "y" Then
    Cells(intcounter, 3).EntireRow.Delete
    x = x + 1
     
    End If
    Next
     
    End Sub
    Last edited by JBeaucaire; 05-30-2014 at 10:34 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Changing code from deleting rows to cut/paste rows into another sheet and delete blank row
    By kmarshall6576 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-18-2013, 01:54 AM
  2. [SOLVED] Delete rows with #N/A values on my sheet using VBA code
    By joh46k in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-03-2013, 10:38 PM
  3. [SOLVED] Code to quickly delete rows in sheet
    By shinichi_nguyen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-20-2012, 01:50 PM
  4. Code to delete rows containing names from a list on another sheet
    By eglassburn in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-23-2011, 12:52 PM
  5. [SOLVED] Code to delete rows and column cells that have formulas in.
    By GarToms in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-18-2006, 02:40 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