Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    May 2002
    Location
    US
    Posts
    439
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help to Tweak existing Macro (2003)

    Hi everyone,


    through the help of the fourm, I have the below code. What I need to do is get it tweaked to only empty a certain cell based upon the match to the list provided on the Tab "match list". I believe the code remains the same up until the

    ".Range("A" & myRow).EntireRow.Delete"

    Not sure how to modify the line to clear the Cell "CW" of the target row.

    thanks,
    Brad



    Public Sub DeleteRowOnMatch()
    Dim myRow As Long
    Dim oSht As Worksheet
    Dim mr As Long
    Dim myRange As Range
    Set myRange = Sheets("Match List").Range("A:A")
    Set oSht = ThisWorkbook.Sheets("CN Data")
    With oSht
    myRow = .Cells(ActiveSheet.Rows.Count, "DB").End(xlUp).Row
    For myRow = myRow To 2 Step -1
    On Error Resume Next
    mr = Application.WorksheetFunction.Match(.Range("DB" & myRow), myRange, 0)
    If Err Then
    On Error GoTo 0
    Else

    .Range("A" & myRow).EntireRow.Delete
    End If
    Next myRow
    End With
    Set oSht = Nothing
    Set myRange = Nothing
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Help to Tweak existing Macro (2003)

    Does it do what you want if you change

    .Range("A" & myRow).EntireRow.Delete

    to

    .Range("CW" & myRow).ClearContents

  3. #3
    4 Star Lounger
    Join Date
    May 2002
    Location
    US
    Posts
    439
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Help to Tweak existing Macro (2003)

    Hans,
    Will test and reply.


    Thanks,
    Brad

  4. #4
    4 Star Lounger
    Join Date
    May 2002
    Location
    US
    Posts
    439
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Help to Tweak existing Macro (2003)

    Absolutly!


    Thanks,
    Brad

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •