Conditional statement

amitshah

Board Regular
Joined
Apr 13, 2002
Messages
80
I have the following code:

If IsError(Application.Find("SKIP", woDataArray(PACKTYPE))) Then
Worksheets(RUNSHEET).Activate
Else
If woDataArray(CUTBACK) > CUTLENGTH Then
Worksheets(SKIPRUNSHEET).Activate
Else
Worksheets(CUTSHEET).Activate
End If
End If

where I have a defined PACKTYPE which if the element of the array is, I want it to activate a certain sheet. But if thats not the case then I want it to check another array element to see if the value of the array elemnt is greater than defined CUTLENGTH to activate SKIPRUNSHEET else to activate CUTSHEET.

But it somehow doesnt seems to go straight to the CUTSHEET even when the elemnt value is greater than CUTLENGTH where it should activate SKIPRUNSHEET.

Why is this the case? Can anyone explain? Thanks.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
What's in your array? It seems to be a mixture of text (find "SKIP") and values (> CUTLENGTH). Is that right?

And should it be?

If Not IsError(Application.Find("SKIP", woDataArray(PACKTYPE))) Then

which will activate RUNSHEET if SKIP is found.
 
Upvote 0

Forum statistics

Threads
1,221,689
Messages
6,161,300
Members
451,695
Latest member
Doug Mize 1024

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top