ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Logical Expression For MULTIPLE Cells??? (https://www.excelbanter.com/excel-programming/348730-logical-expression-multiple-cells.html)

[email protected]

Logical Expression For MULTIPLE Cells???
 
Hello...

I am trying to use VBA (vbscript?) to perform an action if the word
"Enter" does not appear within a range of 5 cells (A1:A5). I have
saved the file with the word "Enter" typed in the cell, and I want the
user to be forced to change the value of all 5 cells before the action
is performed.

I have been able to make this work using only ONE cell in the range
(A1):

If Worksheets("Barcode").Range("A1") = "Enter" Then
(do this)
Else
(do that)

How can I expand this statement to be true for all 5 cells?

Any help would be greatly appreciated!!
Cannon


Bob Phillips[_6_]

Logical Expression For MULTIPLE Cells???
 
For Each cell In Worksheets("Barcode").Range("A1:A5")
If cell.Value = "Enter" Then
(do this)
Else
(do that)
End If
Next cell


--

HTH

RP
(remove nothere from the email address if mailing direct)


wrote in message
ups.com...
Hello...

I am trying to use VBA (vbscript?) to perform an action if the word
"Enter" does not appear within a range of 5 cells (A1:A5). I have
saved the file with the word "Enter" typed in the cell, and I want the
user to be forced to change the value of all 5 cells before the action
is performed.

I have been able to make this work using only ONE cell in the range
(A1):

If Worksheets("Barcode").Range("A1") = "Enter" Then
(do this)
Else
(do that)

How can I expand this statement to be true for all 5 cells?

Any help would be greatly appreciated!!
Cannon




[email protected]

Logical Expression For MULTIPLE Cells???
 
Thanks! Works great.

Cannon



All times are GMT +1. The time now is 02:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com