Hi,
I am trying to create a macro that will search for a row which contains two variable values (cells B3 and B4) and clear only some cells of the row.
I found some codes in the net, modified them a little, and achieved finding a ROW that contains ONE value (B3) and clearing the corresponding cells.
The problem here is that there may be two rows with the same B3 value but not B4 and that if the value in B3 isn't in the given range it deletes data randomly
Hope someone could help!
I am trying to create a macro that will search for a row which contains two variable values (cells B3 and B4) and clear only some cells of the row.
I found some codes in the net, modified them a little, and achieved finding a ROW that contains ONE value (B3) and clearing the corresponding cells.
The problem here is that there may be two rows with the same B3 value but not B4 and that if the value in B3 isn't in the given range it deletes data randomly
Hope someone could help!
Sub Searchdelete1()
'
' Searchdelete1 Macro
' Macro recorded 16/06/2010 by FMARSEI
'
Dim aVab
Dim c As Range
Sheets("Control PE").Select
aVab = Range("B3").Value
For Each c In Range("C8:C100")
If c = aVab Then
c.Select
End If
Next c
ActiveCell.Offset(0, -1).Select
Selection.ClearContents
ActiveCell.Offset(0, 1).Select
Selection.ClearContents
ActiveCell.Offset(0, 1).Select
Selection.ClearContents
ActiveCell.Offset(0, 1).Select
Selection.ClearContents
ActiveCell.Offset(0, 1).Select
Selection.ClearContents
ActiveCell.Offset(0, 1).Select
Selection.ClearContents
Sheets("NOMINACIONES").Select
End Sub