Posted to microsoft.public.excel.programming
|
|
Useing If to Delete a Range
Hi Don,
You only need to work backwards from the bottom if deleting rows. With
Clearcontents, it does not matter. I think that the OP's main problem was as
stated "My big problem is the next " because the End If had been omitted.
--
Regards,
OssieMac
"Don Guillett" wrote:
work from the BOTTOM up. Something like
mc="bd"
for i = cells(rows.count,mc).end(xlup).row to 2 step -1
if cells(i,mc)<=32 then range(cells(i,"c"),cells(i,"bb")).clearcontents
next i
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"ytayta555" wrote in message
...
HY ALL !
My big problem is the next : I work in a whole
worksheet ,[ from cell 91 to cell 65536 ] ; I have need a
macro which to ClearContents of Range ,,C91:BB91,,
if the value of cell BD91 < = 32 ; then next row , the
same problem : if BD92 < = 32 , then , to delete ,,the Range" :
,,C92:BB92,, ; then , next row , and so on , from Row 91 to Row
65536 . Please very much to help me !
The macro can look like this [ I write this for pattern ] ,
but how can I modify it ?
Sub Macrocomanda3()
Dim Row As Integer, Col As Integer
For Col = 1 To 4
For Row = 1 To 10
If ActiveSheet.Cells(Row, Col) = 1 Then
ActiveSheet.Cells(Row, Col).ClearContents
Next Row
Next Col
End Sub
RESPECTFULLY TO ALL !
|