Thread: Need help
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Need help

I'm sure x is a variable as you say.

Gord

On Fri, 12 Feb 2010 22:00:05 -0500, "JLGWhiz" wrote:

Hi Gord, I assomed that since the OP said his illustration code worked that
x was either a object variable or a data variable. But without a
declaration, one never knows.


"Gord Dibben" <gorddibbATshawDOTca wrote in message
.. .
I don't see where x have been defined.

You have to define the variable x or double-quote it if you really meant
"x"


Gord Dibben MS Excel MVP

On Fri, 12 Feb 2010 16:44:01 -0800, JLeCoure
wrote:

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



.