ERRORS in VBA FUnctions "InputBox" & "Select Case"

Mackeral

Board Regular
Joined
Mar 7, 2015
Messages
232
Office Version
  1. 365
Platform
  1. Windows
These 2 VBA expressions do not function as it the are documented to, and I found that these had been recently implimented and broke code I've been running for years.

INPUTBOX

The docmentation says that if you hit the "Cancel" key that the routine returns a FALSE.
It now returns an Empty String.

The workaround is to use the SetStr function to test for the Escape Key having been used:
Code:
Test = SetStr(Arg) = 0
"Arg" being the string returned from the InputBox call.

SELECT CASE
The documentation refers to using "Is" or "Like" prior to haing a calculation as part of a "Case" statement. Not only that these don't work; now you can't have any calculations in the "Case" statement. It does not respond to a TRUE or FALSE argument, only what has been presented in the "Select Case" statement.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
But I have another Case statement in my code which does work:
Code:
Case Function_Returing_TRUE_or_FALSE(Arg)   <-- Statement B
So what is the difference between Statement A and Statement B?

The B statement won't work either if the function returns a True or Flase boolean.
 
Upvote 0

Forum statistics

Threads
1,215,145
Messages
6,123,289
Members
449,094
Latest member
GoToLeep

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