Thread: Need help
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz[_2_] JLGWhiz[_2_] is offline
external usenet poster
 
Posts: 1,565
Default Need help

This should do it:

Sub stantiate()
Dim lr As Long, sh As Worksheet, rng As Range
Set sh = Sheets("Adjustment")
lr = sh.Cells(Rows.Count, 9).End(xlUp).Row
Set rng = sh.Range("I7:I" & lr)
For Each c In rng
If c = x Then
sh.Range("A" & c.Row & ":H" & c.Row).ClearContents
End If
Next
End Sub




"JLeCoure" wrote in message
...
I am trying to create a macro that looks a cell and if that cell is "true"
then I want the macro to clear the fields to the left of that cell. I
have
got it to work on a line by line basis but I wan to be able to set this
macro
up to work on any line

Here is the code I have trying to get variables to work in it

If i7 = x Then Worksheets("Adjustment").Range("A7:h7").ClearConte nts