View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Myles[_51_] Myles[_51_] is offline
external usenet poster
 
Posts: 1
Default Delete Rows question


I wish to get the following standard row-deletion code to be tweaked to
delete (not an enrireRow) but only rows across 3 columns - Columns A to
C.
I resorted to RESIZE method without success.

Sub DeleteRowsByCollection()

Dim c as Range
Dim rng as Range

For each c in Range("a1:a" & [a65536].End(xlUp).row)
If c.value = c.Offset(1,0).value Then
If rng Is Nothing Then
set rng = c.Resize(0,3) ========Application-defined or object-defined
error
Else
set rng = Union(rng, c.Resize(0,3))
End if
End if
Next

If not rng is Nothing then
rng.Delete
End if

End Sub

Deferring the RESIZING and applying it to the DELETE command as in
*rng.Resize(0,3).Delete * generates the same error.

TIA

Myles


--
Myles
------------------------------------------------------------------------
Myles's Profile: http://www.excelforum.com/member.php...o&userid=28746
View this thread: http://www.excelforum.com/showthread...hreadid=522055