#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 237
Default Code Edit

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Code Edit

If InStr(1, .Offset(, 1).NumberFormat, "%") or _
InStr(1, .Offset(, 2).NumberFormat, "%") Then

--
Regards,
Tom Ogilvy


Todd Huttenstine wrote in message
...
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
edit & configure add button & code [email protected] uk Excel Discussion (Misc queries) 1 November 23rd 08 08:28 PM
edit configure add button and code [email protected] uk Excel Discussion (Misc queries) 2 November 23rd 08 10:26 AM
Edit this macro code to loop and end GarToms Excel Discussion (Misc queries) 1 January 27th 06 12:50 PM
edit hyperlink code cont from 12/8/04 doug Excel Discussion (Misc queries) 4 December 17th 04 11:51 PM
Emailing Sheets Code Edit Todd Huttenstine[_2_] Excel Programming 2 November 17th 03 07:46 PM


All times are GMT +1. The time now is 09:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"