Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JTF JTF is offline
external usenet poster
 
Posts: 8
Default IFELSE question, as it applies to multiple cells

Hi all
I have this code working for one cell

If Range("h1") = 3 Then
If Range("f19") = "" Then
Range("b52") = ""
ElseIf Range("f19") = "149028" Then
Range("b52") = ""
Else: Range("B52") = "ERROR"
End If

However, the same condition has to exist for cells F20-F38 - in other
words, if H1=3, any, some or all of those cells (F20-F38) can either be
null or contain "149028", or an error will display in cell B52.

I cannot for the life of me figure out how to include the additional
cells. Can someone give me a hint? I have tried everything I can
think of and nothing seems to work. Any assistance much appreciated.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default IFELSE question, as it applies to multiple cells


Dim c As Range
If Range("h1") = 3 Then
Range("b52") = ""
For Each c In Range("F20:F38")
If c.Text < "" And c.Text < "149028" Then
Range("B52") = "ERROR"
Exit Sub
End If
Next
End If

Regards - Steve.

"JTF" wrote in message oups.com...
Hi all
I have this code working for one cell

If Range("h1") = 3 Then
If Range("f19") = "" Then
Range("b52") = ""
ElseIf Range("f19") = "149028" Then
Range("b52") = ""
Else: Range("B52") = "ERROR"
End If

However, the same condition has to exist for cells F20-F38 - in other
words, if H1=3, any, some or all of those cells (F20-F38) can either be
null or contain "149028", or an error will display in cell B52.

I cannot for the life of me figure out how to include the additional
cells. Can someone give me a hint? I have tried everything I can
think of and nothing seems to work. Any assistance much appreciated.



  #3   Report Post  
Posted to microsoft.public.excel.programming
JTF JTF is offline
external usenet poster
 
Posts: 8
Default IFELSE question, as it applies to multiple cells

Wow Steve! I can't thank you enough....that works, and I actually
understand it!

VB is very new to me, and I appreciate all of the help I can get.
Thanks again!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default IFELSE question, as it applies to multiple cells

N.P., welcome to VB programming.

Regards- Steve.

"JTF" wrote in message ps.com...
Wow Steve! I can't thank you enough....that works, and I actually
understand it!

VB is very new to me, and I appreciate all of the help I can get.
Thanks again!



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 formatting only applies to part of cell text klkropf Excel Worksheet Functions 12 April 15th 14 03:53 PM
this also applies to Microsoft Word, both Office 2003 majulitrois Excel Discussion (Misc queries) 0 October 3rd 08 12:50 AM
criteria applies to a range of dates. pebbles Excel Discussion (Misc queries) 3 May 6th 08 01:13 AM
Sum of data where a condition applies kippers Excel Discussion (Misc queries) 1 March 20th 07 12:45 PM
How to specify which cells/columns macro applies to? Workaholic Excel Worksheet Functions 1 August 14th 06 05:52 PM


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