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

Below is a code that looks in columns P,Q, and R and if it
finds the character "%" will put the value "percent" in
the cell in columnO. I would also like the code to also
look for another condition. That is I want it to look in
the cell in ColumnN and if it finds the value "percent"
anywhere in that cell, will also put the value "percent"
in the cell in columnO.


Dim c As Range
For Each c In Range("O2:O100").Cells
With c

If InStr(1, .Offset(,
1).NumberFormat, "%") Or _
InStr(1, .Offset(, 2).NumberFormat, "%")
Or _
InStr(1, .Offset(, 3).NumberFormat, "%")
Then
.Value = "percent"
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Format

Add:

Or _
InStr(1, .Offset(, -1).NumberFormat, "%")

to your code.

--

Vasant

"Todd Huttenstine" wrote in message
...
Below is a code that looks in columns P,Q, and R and if it
finds the character "%" will put the value "percent" in
the cell in columnO. I would also like the code to also
look for another condition. That is I want it to look in
the cell in ColumnN and if it finds the value "percent"
anywhere in that cell, will also put the value "percent"
in the cell in columnO.


Dim c As Range
For Each c In Range("O2:O100").Cells
With c

If InStr(1, .Offset(,
1).NumberFormat, "%") Or _
InStr(1, .Offset(, 2).NumberFormat, "%")
Or _
InStr(1, .Offset(, 3).NumberFormat, "%")
Then
.Value = "percent"



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Format

That didnt have any affect.
I need for it to search the values in column N which is
offset -1 for "percent". And if it finds this string, to
make the value in cell O say "percent". The values in
columnN can say "Percentage" or "Percentile". Whatever
the case, because the value contains the string "percent"
I need for the code to work.



-----Original Message-----
Add:

Or _
InStr(1, .Offset(, -1).NumberFormat, "%")

to your code.

--

Vasant

"Todd Huttenstine"

wrote in message
...
Below is a code that looks in columns P,Q, and R and if

it
finds the character "%" will put the value "percent" in
the cell in columnO. I would also like the code to also
look for another condition. That is I want it to look

in
the cell in ColumnN and if it finds the value "percent"
anywhere in that cell, will also put the value "percent"
in the cell in columnO.


Dim c As Range
For Each c In Range("O2:O100").Cells
With c

If InStr(1, .Offset(,
1).NumberFormat, "%") Or _
InStr(1, .Offset(, 2).NumberFormat, "%")
Or _
InStr(1, .Offset(, 3).NumberFormat, "%")
Then
.Value = "percent"



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Format

I had to use the code...


If InStr(1, .Offset(, -
1).Value, "Percent") Or _
InStr(1, .Offset(, 1).NumberFormat, "%")
Or _
InStr(1, .Offset(, 2).NumberFormat, "%")
Or _
InStr(1, .Offset(, 3).NumberFormat, "%")
Then
.Value = "percent"


-----Original Message-----
Add:

Or _
InStr(1, .Offset(, -1).NumberFormat, "%")

to your code.

--

Vasant

"Todd Huttenstine"

wrote in message
...
Below is a code that looks in columns P,Q, and R and if

it
finds the character "%" will put the value "percent" in
the cell in columnO. I would also like the code to also
look for another condition. That is I want it to look

in
the cell in ColumnN and if it finds the value "percent"
anywhere in that cell, will also put the value "percent"
in the cell in columnO.


Dim c As Range
For Each c In Range("O2:O100").Cells
With c

If InStr(1, .Offset(,
1).NumberFormat, "%") Or _
InStr(1, .Offset(, 2).NumberFormat, "%")
Or _
InStr(1, .Offset(, 3).NumberFormat, "%")
Then
.Value = "percent"



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Format

That was pretty much what I suggested ... ;-)

--

Vasant


wrote in message
...
I had to use the code...


If InStr(1, .Offset(, -
1).Value, "Percent") Or _
InStr(1, .Offset(, 1).NumberFormat, "%")
Or _
InStr(1, .Offset(, 2).NumberFormat, "%")
Or _
InStr(1, .Offset(, 3).NumberFormat, "%")
Then
.Value = "percent"


-----Original Message-----
Add:

Or _
InStr(1, .Offset(, -1).NumberFormat, "%")

to your code.

--

Vasant

"Todd Huttenstine"

wrote in message
...
Below is a code that looks in columns P,Q, and R and if

it
finds the character "%" will put the value "percent" in
the cell in columnO. I would also like the code to also
look for another condition. That is I want it to look

in
the cell in ColumnN and if it finds the value "percent"
anywhere in that cell, will also put the value "percent"
in the cell in columnO.


Dim c As Range
For Each c In Range("O2:O100").Cells
With c

If InStr(1, .Offset(,
1).NumberFormat, "%") Or _
InStr(1, .Offset(, 2).NumberFormat, "%")
Or _
InStr(1, .Offset(, 3).NumberFormat, "%")
Then
.Value = "percent"



.



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
Lock Cell Format - Allow copy and paste of data without format change Chris12InKC Excel Worksheet Functions 2 May 9th 23 07:42 PM
Adding time in 24 hour format to produce hours in decimal format Hercdriver Excel Worksheet Functions 11 December 29th 09 02:06 AM
Need help with converting CUSTOM format/TEXT format to DATE format Deo Cleto Excel Worksheet Functions 6 June 2nd 09 08:14 PM
Replace million-billion number format to lakhs-crores format Sumit Excel Discussion (Misc queries) 1 December 9th 05 04:58 PM
how to format excel format to text format with separator "|" in s. azlan New Users to Excel 1 January 31st 05 12:57 PM


All times are GMT +1. The time now is 09:23 PM.

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"