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

If I want to insert an OR statement in this sub, how would I do it? IF Range("a4 or b4 or c4 or d4").Text = "Due" then..

Sub Balance(
With Range("g1"
IF Range("c4").Text = "Due" The
.Cells.Formula = "=sum(a2,f3)
Els
.Cells.Formula =
End I
End Wit
End Su

Thanks
Howard
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default OR

You can use this Howard

If Application.WorksheetFunction.CountIf _
(Range("A4:D4"), "Due") 0 Then

Or

If Range("A4").Text = "Due" Or _
Range("B4").Text = "Due" Or _
Range("C4").Text = "Due" Or _
Range("D4").Text = "Due" Then


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Howard" wrote in message ...
If I want to insert an OR statement in this sub, how would I do it? IF Range("a4 or b4 or c4 or d4").Text = "Due" then...

Sub Balance()
With Range("g1")
IF Range("c4").Text = "Due" Then
.Cells.Formula = "=sum(a2,f3)"
Else
.Cells.Formula = 0
End If
End With
End Sub

Thanks,
Howard



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default OR

One way
Sub ifdue()
If Application.CountIf(Range("a4:b4"), "a") 0 Then
Range("g3") = Application.Sum(Range("a2:f3"))
End If
End Sub
--
Don Guillett
SalesAid Software

"Howard" wrote in message
...
If I want to insert an OR statement in this sub, how would I do it? IF

Range("a4 or b4 or c4 or d4").Text = "Due" then...

Sub Balance()
With Range("g1")
IF Range("c4").Text = "Due" Then
.Cells.Formula = "=sum(a2,f3)"
Else
.Cells.Formula = 0
End If
End With
End Sub

Thanks,
Howard



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default OR

Thanks
I am indeed grateful for you gurus

Howard
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default OR

Thanks, Don
I'm always impressed by how versitile Excel is

HF
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



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