Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Thanks again.
I have not had a chance to get back to this project till today. Still getting an mismatch error. I have a function in I column =IF((H7=""),"",IF(TODAY()(30+H7),"X","")) that marks an X in the I column if it is past 30 days in column H. If this is true I want the macro to delete Columns A-h on that row "JLGWhiz" wrote: I was not sure what x was. Try this: 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.value = x Then sh.Range("A" & c.Row & ":H" & c.Row).ClearContents End If Next End Sub This modification assumes that the x variable is a value and not a range object. "JLeCoure" wrote in message ... Thanks for the Help I am getting the following error when I run this Runtime err 13 Type mismatch see below where the error happens "JLGWhiz" wrote: 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 <--------Here 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 . . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|