Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 237
Default Conditional Data formats

I have 2 ranges of data. I have range O2:O100 which will
contain values based on data in Range P2:P100.

I need a code that will look through every value in range
P2:P100 and if it finds a % in any of the values, I need
the value of the corresponding cell in Range O2:O100 to
be "%".

If it finds just a raw number (such as 45, 140, 25,
etc...) in any of the values, I need the value of the
corresponding cell in Range O2:O100 to be "General".

Thanks in advance.

Todd
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Conditional Data formats

Something like (not exactly clear on your requirements):

Sub ConformFormats()
Dim c As Range
For Each c In Range("O2:O100")
If InStr(1, c.Offset(, 1).NumberFormat, "%") Then
c.NumberFormat = c.Offset(, 1).NumberFormat
Else
c.NumberFormat = ""
End If
Next
End Sub

--

Vasant




"Todd Huttenstine" wrote in message
...
I have 2 ranges of data. I have range O2:O100 which will
contain values based on data in Range P2:P100.

I need a code that will look through every value in range
P2:P100 and if it finds a % in any of the values, I need
the value of the corresponding cell in Range O2:O100 to
be "%".

If it finds just a raw number (such as 45, 140, 25,
etc...) in any of the values, I need the value of the
corresponding cell in Range O2:O100 to be "General".

Thanks in advance.

Todd



  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Conditional Data formats

Hey instead of formatting it with %, I would like it to
put an actual % in the cell in Rango O2:O100.


-----Original Message-----
Something like (not exactly clear on your requirements):

Sub ConformFormats()
Dim c As Range
For Each c In Range("O2:O100")
If InStr(1, c.Offset(, 1).NumberFormat, "%") Then
c.NumberFormat = c.Offset(, 1).NumberFormat
Else
c.NumberFormat = ""
End If
Next
End Sub

--

Vasant




"Todd Huttenstine"

wrote in message
...
I have 2 ranges of data. I have range O2:O100 which

will
contain values based on data in Range P2:P100.

I need a code that will look through every value in

range
P2:P100 and if it finds a % in any of the values, I need
the value of the corresponding cell in Range O2:O100 to
be "%".

If it finds just a raw number (such as 45, 140, 25,
etc...) in any of the values, I need the value of the
corresponding cell in Range O2:O100 to be "General".

Thanks in advance.

Todd



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Conditional Data formats

Also a bit unclear as to what O contains.

Does this help?

Dim i As Long

For i = 1 To 100
If Not IsEmpty(Cells(i, 15)) Then
If Right(Cells(i, 15).NumberFormat, 1) = "%" Then
Cells(i, 16).Value = "%"
ElseIf IsNumeric(Cells(i, 15).Value) Then
Cells(i, 16).Value = "General"
End If
End If
Next


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

wrote in message
...
Hey instead of formatting it with %, I would like it to
put an actual % in the cell in Rango O2:O100.


-----Original Message-----
Something like (not exactly clear on your requirements):

Sub ConformFormats()
Dim c As Range
For Each c In Range("O2:O100")
If InStr(1, c.Offset(, 1).NumberFormat, "%") Then
c.NumberFormat = c.Offset(, 1).NumberFormat
Else
c.NumberFormat = ""
End If
Next
End Sub

--

Vasant




"Todd Huttenstine"

wrote in message
...
I have 2 ranges of data. I have range O2:O100 which

will
contain values based on data in Range P2:P100.

I need a code that will look through every value in

range
P2:P100 and if it finds a % in any of the values, I need
the value of the corresponding cell in Range O2:O100 to
be "%".

If it finds just a raw number (such as 45, 140, 25,
etc...) in any of the values, I need the value of the
corresponding cell in Range O2:O100 to be "General".

Thanks in advance.

Todd



.



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
Conditional Formats, how to scroll and view all formats? Bill E Excel Worksheet Functions 0 May 12th 10 07:58 PM
Conditional Formats lau Excel Discussion (Misc queries) 1 December 23rd 09 07:49 PM
Conditional formats- paste special formats? jcarney Excel Discussion (Misc queries) 1 November 1st 07 06:37 PM
paste conditional formats as formats leo Excel Discussion (Misc queries) 2 July 5th 07 10:06 AM
More than 3 Conditional Formats Kris_Wright_77 Excel Discussion (Misc queries) 0 February 15th 07 08:31 PM


All times are GMT +1. The time now is 08:32 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"