Questions tagged [select-case]
164 questions
0
votes
1 answer
How do I use combobox values with a function and select case?
I am writing a program that will get a user to select their zodiac sign and another persons sign. Once that comes in, I want to use the signs to gauge their compatibility, the result of which falls into 3 categories. I have the program to the point…

user3326479
- 1
- 1
0
votes
2 answers
Is it possible to add cases to a Select Case based on the number of entries in a table?
I've been messing around with VBA in Excel a bit recently; and as a small project for myself, I'm trying to create a "draw names from a hat" sort of macro.
I began by generating a random number, and then choosing which entry from a Table (i.e.…

detroitwilly
- 811
- 3
- 16
- 30
0
votes
1 answer
Select Case Not Running Every Case
I have a select case function inside an excel document that is not running every case. Specifically, it is skipping 12044-12053. I do not understand why it isn't treating all of the data the same.
Sub Main()
Dim c As Range
For Each c In…

autumntiger
- 105
- 1
- 13
0
votes
1 answer
comparison structure within select case
I don't use select case much but thought it was appropriate for this function. How does one do the comparison for the 2nd and third cases? The compiler doesn't like that code. Is it not possible to compare in this manner within Select Case?
Private…

dinotom
- 4,990
- 16
- 71
- 139
0
votes
1 answer
Only uses Case 1 using enumeration in case statement (Visual Basic)
The program is supposed to use the enumeration type declared at the beginning within the Select Case statement. When I run the program, no matter which operator I select, it only uses the first case statement (for add). I tried rearranging them in…

mkingsley11
- 3
- 1
0
votes
2 answers
Conditionally skip cases
In a Select...Case statement, is there a way to skip cases based on a precondition?
What I'm doing now, using an incredibly stupid example:
Private Sub PrintNumbers(includeEvenNumbers As Boolean, includeOddNumbers As Boolean)
For number As…

Steven Liekens
- 13,266
- 8
- 59
- 85
0
votes
1 answer
How to include a number and string in select case statement
I'm trying to find a way to only allow a user to input ".32" or "Not Used" into my datagridviewcell. Right now my code stands as below. When I run the code all it does is change everything to "Not Used". Even if I type in ".32" it will change it to…

stackexchange12
- 622
- 9
- 20
- 41
0
votes
2 answers
Using a Select Statement Based on Check Box Being Checked
Firstly I would like to say this was a homework assignment I was working on, but couldn't get it to work this way. So I had to complete the assignment using If statements. The objective was to build essentially a form that a user could fill out to…

Dion Pezzimenti
- 243
- 2
- 11
0
votes
4 answers
SELECT CASE Syntax Error
I have the following @temp table :
------------------------------------
|Condition_ID Operator Order |
| 1 == 1 |
| 2 <> 3 |
| 3 == 2 …

hermann
- 6,237
- 11
- 46
- 66
0
votes
1 answer
SQL Sum with conditions in a select case
have the following sql query
select catalogid
, sum(numitems) numitems
, sum(allitems) - sum(numitems) ignoreditems
from
(
select i.catalogid
, case
when (ocardtype in ('PayPal','Sofort') OR
ocardtype in…

user1570048
- 880
- 6
- 35
- 69
0
votes
2 answers
Select Case with Function EndsWith()
The code below works, I can't help thinking there is a better way to do this though. Is anyone experienced with using functions in conjunction with Select Statements.
The code I would expect to work would be something along the lines...
Select Case…

Ccorock
- 892
- 12
- 37
0
votes
3 answers
SQL check if numrical value is 0 for a field where id is=333
inside an SQL SELECT CASE STATEMENT how would i check if the a value for some coulmn in sometable is equal to 0 where the id is equal to something?

user1570048
- 880
- 6
- 35
- 69
0
votes
3 answers
SQL joining 2 queries that share a column
I have 2 SQL queries that share a column called catalogid
Query #1:
Select
catalogid, numitems, allitems - numitems ignoreditems
from
(select
i.catalogid,
sum(case when (ocardtype in ('PayPal','Sofort') OR
ocardtype…

user1570048
- 880
- 6
- 35
- 69
-1
votes
1 answer
select case stop at the first false condition
the problem as follows:
TOut = 11:00:00 PM
TCheckIn = 10:00:00 PM
in my code, select case, stop at the first condition and the result is -1:00:00 (I figured out with ABS function).
here the code:
Public Function TIMECOMPARE(TIn As Date, TOut As…

Nik
- 11
- 3
-1
votes
2 answers
Excel VBA to change background image of shape by clicking on shape
first time posting for some help that I can't find after exhaustive search. I'm sure this is easy for someone who know what they are doing.
I'm looking for VBA that will cycle through background images (saved on my computer) within in a shape by…

vutopia
- 3
- 2