View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Otto Otto is offline
external usenet poster
 
Posts: 11
Default loop code on cell range

Please help,I am new to code and want to do the following.
I need to delete information on a worksheet which are older than a specified
date and then loop the code through a range up to 500 times.The macro
evaluate the date in cell a3 and if the date are older than than today less
let say 30 days it should then clear contents through range a3:q3 and move to
a4 and so on.
this is the code as i have it at the moment and it works fine except that i
have to repeat the code for each roe in the range.Is there another way to do
this?
Sub Button10_Click()
UserForm2.Show
If Range("r3") = Range("r1") Then
Range("a3:q3").Select
Selection.ClearContents
Range("a3").Select
ElseIf Range("r3") < Range("r1") Then
End If
Sub Button10_Click()
UserForm2.Show
If Range("r43") = Range("r1") Then
Range("a4:q4").Select
Selection.ClearContents
Range("a4").Select
ElseIf Range("r4") < Range("r1") Then
End If