Useing If to Delete a Range
Hi,
Try this code:
Sub Clear_Ranges()
' Macro recorded 3/5/2008 by Tim
Dim cell As Range, rng As Range
Set rng = Range(Cells(1, "BD"), Cells(Rows.Count, "BD").End(xlUp))
For Each cell In rng
If cell.Value < 32 Then
Cells(cell.Row, "C").Select
Selection.Resize(1, 52).Select
Selection.ClearContents
End If
Next
End Sub
Regards,
Tim
"ytayta555" wrote:
On 5 Mar, 03:41, OssieMac wrote:
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
1= I must declare the Range ,,myRange" C91:BB91 and i don't know how;
2=then I must do something like this : For myRange = C91:BB91 To
C65536:BB65536
3=I must set Column BD {mean56} , in this macro ;
3=I think I must put 1 Next : ,,Next lngRow"
and the macro with this settings can look so ..(I think..) :
Dim lngRow As Long, lngCol As Long
lngCol = "BD"
For lngRow = 91 To 65536
If ActiveSheet.Cells(lngRow, lngCol) )<=32 then
range(cells(myRange)),clearcontents
End If
Next lngRow
End Sub
This macro must understand something like : if BD91 <=32 then
EntireRow.ClearContents...BUT I
have need to clear only range C91:BB91 of the Row of active cell ;
I specificate that the initial macro is for pattern ;
please help me with this new sugestion .
Respectfully to All
|