View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default macro for deleting cells trought column A

Hi,

You weren't specific about what the number was to begin with so this uses 9.
Change to suit.

Right click your sheet tab, view code and paste this in and run it.

Sub delete_Me()
Dim CopyRange As Range, MyRange As Range
Lastrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set MyRange = Range("A1:A" & Lastrow)
For Each C In MyRange
If Left(C.Value, 1) = 9 Then
If CopyRange Is Nothing Then
Set CopyRange = C.EntireRow
Else
Set CopyRange = Union(CopyRange, C.EntireRow)
End If
End If
Next
If Not CopyRange Is Nothing Then
CopyRange.Delete
End If
End Sub

Mike

"tabađija" wrote:

hello!

my problem begins with a lot of data.
i need macro to delete all number values in A columns and a entire
row.
or all cell which begins with a certain number (1,...,9).

tnx.