Eliminate one cell

S

Steph

Hi. The code below scans an entire worksheet, and hardcodes and cell with a
vlookup formula in it. How can I vary this to EXCLUDE cell C1, meaning
leave the vlookup formula in cell C1? Thanks!


Dim rCell As Range
For Each rCell In ActiveSheet.UsedRange.Cells
If UCase(Left(rCell.FormulaR1C1, 8)) = "=VLOOKUP" Then rCell.Value =
rCell.Value
Next rCell
 
D

Dave Peterson

Dim rCell As Range
For Each rCell In ActiveSheet.UsedRange.Cells
if rcell.address = "$C$1" then
'skip it
else
If UCase(Left(rCell.FormulaR1C1, 8)) = "=VLOOKUP" Then
rCell.Value = rCell.Value
end if
end if
Next rCell
 
T

Trevor Shuttleworth

Steph

one way:

Dim rCell As Range
For Each rCell In ActiveSheet.UsedRange.Cells
If rCell.Address <> "$C$1" Then
If UCase(Left(rCell.FormulaR1C1, 8)) = "=VLOOKUP" Then
rCell.Value = rCell.Value
End If
End If
Next rCell

Regards

Trevor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top