|
-
Jul 31st, 2006, 11:02 AM
#1
Thread Starter
New Member
Using an If statement in vba for multiple records in a range
Hi all. I am using the following bit of code:
Dim rngCalc As Range
Set rngCalc = Range("AD2:AD" & Cells(Rows.Count, 1).End(xlUp).Row)
rngCalc.Formula = "=(8-K2)"
rngCalc.Value = rngCalc.Value
In this case, the first cell to be replaced is AD2 and it continues for as many rows as I have. What I want to do is use some If statements in conjuction with this, and have these if statements run for each cell (AD2, AD3, AD4, etc)
So in this case, if AD2 = 7 then xxxxxxxxxxxxxx
And so on. Im not sure how to word it. Should it be 'if rngcalc.value = 7'?
I tried that and got a type mismatch. Any help would be appreciated with this, thanks!!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|