View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Hankjam[_2_] Hankjam[_2_] is offline
external usenet poster
 
Posts: 23
Default Macro to delete rows

Arrgghh

Sorry. I meant to delete the rows...

I'll give this a go and see what happens

Many thank Mike

Aj


On Wed, 1 Oct 2008 07:08:06 -0700, Mike H
wrote:

Hi,

In your message header you ask to delete rows and in the body of the message
you seem to say delete the values. This does the latter. Right click your
sheet tab, vuew code and paste this in and run it

Sub stance()
Dim MyRange
Dim copyrange As Range
Set MyRange = Range("AX386:AX500")
For Each c In MyRange
If c.Value = 999 And c.Offset(, 26).Value = 999 And c.Offset(, 52).Value =
999 Then
Set copyrange = Union(c, c.Offset(, 26), c.Offset(, 52))
copyrange.ClearContents
Set copyrange = Nothing

End If
Next
End Sub

Mike

"Hankjam" wrote:

Hello

I would like a macro that deal with this task.

I have Range from A1:H385.

After sorting, a number of rows will have 999 in AX, BX and CX.

The number of rows with this condition will vary, depending on how
busy the process is going to be.

I would like a macro to delete these and from Row386 to Row500.

Many thanks for your time.

Aj