Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 237
Default 3 VBA Conditions(last edit)

I have Range O2:O100 and P2:R100. The below code
looks in Range P2:R100 and if it finds a % in any of the
values, will offset into the corresponding cell in Range
O2:O100 and will put the value "percent" in the cell
itself. If it cannot find a % in any of the values in
Range P2:R100, will offset into the corresponding cell in
Range O2:O100 and will put the value "number" in the cell
itself.


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"
Else
.Value = "number"
End If
End With
Next c

Instead I need the code to perform the following. There
are a total of 3 conditions. The first condition is the %
condition which has already been addressed. The 2nd
condition is the time format. If it finds a : value in
Range P2:R100, I need it to offset into the corresponding
cell in Range O2:O100 and put the value "time" in the cell
itself.

And last, if it does not find a % or a : in any of the
value in Range P2:R100, then I need for it to offset into
the corresponding cell in Range O2:O100 and put the the
value "number" in the cell itself.



Thanx
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 3 VBA Conditions(last edit)

The basic structure here would be :-

'----------------------------------------------
If .......... Then
'code
ElseIf ............ Then
'code
ElseIf ........... Then
'code
Else
'code
End If
'-----------------------------------------

You could presumably do a similar search for ":" to get time, or you
might find this useful :-

If IsNumber(c.Value) Then c.Value = "number"


---
Message posted from http://www.ExcelForum.com/

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 237
Default 3 VBA Conditions(last edit)

Thank you. This helped.


-----Original Message-----
The basic structure here would be :-

'----------------------------------------------
If .......... Then
'code
ElseIf ............ Then
'code
ElseIf ........... Then
'code
Else
'code
End If
'-----------------------------------------

You could presumably do a similar search for ":" to get

time, or you
might find this useful :-

If IsNumber(c.Value) Then c.Value = "number"


---
Message posted from http://www.ExcelForum.com/

.

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
Countif Conditions - Use of conditions that vary by cell value JonTarg Excel Discussion (Misc queries) 1 May 30th 08 01:21 PM
2 Conditions + Sum of a colum matching those conditions Jeffa Excel Worksheet Functions 5 June 8th 07 12:14 AM
shade cells based on conditions - i have more than 3 conditions Mo2 Excel Worksheet Functions 3 March 30th 07 07:19 AM
Why can't I edit my excel document? Edit buttons shaded. Arl @ CBC New Users to Excel 3 September 7th 05 01:18 AM
How to multiple conditions to validate more than 2 conditions to . Bhuvana Govind Excel Worksheet Functions 1 January 28th 05 07:07 PM


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