This will do it:
Sub step_backwards()
Dim myLastRow As Long
Dim r As Long
Dim c As Range
myLastRow = ActiveSheet.Cells(10000, 1).End(xlUp).Row
For r = myLastRow To 1 Step -1
Set c = ActiveSheet.Range("a" & r)
If c.Value = "User" Or c.Value = "Theodore Galin" Then
c.ClearContents
End If
Next r
End Sub
Use this if you want the entire row to shift up as well as delete the
contents of the cell:
Sub step_backwards()
Dim myLastRow As Long
Dim r As Long
Dim c As Range
myLastRow = ActiveSheet.Cells(10000, 1).End(xlUp).Row
For r = myLastRow To 1 Step -1
Set c = ActiveSheet.Range("a" & r)
If c.Value = "User" Or c.Value = "Theodore Galin" Then
c.EntireRow.Delete
End If
Next r
End Sub
Remember, backup your data before you start deletin' stuff!! Just in case
it does something you don't expect.
Regards,
Ryan---
--
RyGuy
"Mike H" wrote:
> hi,
>
> Right click your sheet tab, view code and paste this in and run it. If you
> mean contains those 2 string among other thext then change =1 to > 0
>
> Sub Sonic()
> Dim MyRange, MyRange1 As Range
> LastRow = Cells(Rows.Count, "A").End(xlUp).Row
> Set MyRange = Range("A1:A" & LastRow)
> For Each c In MyRange
> If InStr(1, c.Value, "user", vbTextCompare) = 1 Or _
> InStr(1, c.Value, "Theodore Galin", vbTextCompare) = 1 Then
> c.ClearContents
> End If
> Next
> End Sub
>
>
> Mike
>
> "TGalin" wrote:
>
> > I would like to create a macro that will search Column A and every time it
> > finds a cell that says "User" or "Theodore Galin" the contents of that cell
> > will be deleted. Can you help me with this?
|