Code Edit

  • Thread starter Thread starter Todd Huttenstine
  • Start date Start date
T

Todd Huttenstine

I have Range O2:O100 and P2:R100. The below code
currently looks in Range P2:P100 and if it finds a % in
the value,
will offset into the corresponding cell in Range O2:O100
and will put the % character in the cell itself.

Instead of the code only looking in Range P2:P100 for a %
in the value, I would like for the code to look in the
range expanded to P2:R100 for a % in the value.


Dim c As Range
For Each c In Range("O2:O100").Cells
With c
If InStr(1, .Offset(,
1).NumberFormat, "%") Then
.Value = "percent"
Else
.Value = "number"
End If
End With
Next c
 
If InStr(1, .Offset(, 1).NumberFormat, "%") or _
InStr(1, .Offset(, 2).NumberFormat, "%") Then
 

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

Similar Threads

3 VBA Conditions(last edit) 2
Conditional value code 2
Code 2
Conditional Data formats 3
Format 4
Loop Problem 10
make selection in listbox html with vba 0
Conditional Formatting 3

Back
Top