View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default Useing If to Delete a Range

Two problems. You did not have an End If andyou should not use Row which is
a reserved word. Prefixing your variables to indicate the type of variable
gets over the problem of using reserved words.

Try this:-

Sub Macrocomanda3()

Dim intRow As Integer, intCol As Integer

For intCol = 1 To 4
For intRow = 1 To 10
If ActiveSheet.Cells(intRow, intCol) = 1 Then
ActiveSheet.Cells(intRow, intCol).ClearContents
End If
Next intRow
Next intCol

End Sub


--
Regards,

OssieMac


"ytayta555" wrote:

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 !