ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Setting up and Configuration of Excel (https://www.excelbanter.com/setting-up-configuration-excel/)
-   -   Excel Question (https://www.excelbanter.com/setting-up-configuration-excel/108741-excel-question.html)

Mindie

Excel Question
 
I have a spreadsheet that I am working on where I define some of the
information in an area on the excel sheet (For example I have 1/2, 1, 2, 2/4,
3, 4, 4/5, 5, 5/6. These fields are used for a drop down list on the same
excel sheet and allow them to pick one of these numbers within that cell. I
then take the information from that cell and input it on a cartoon to display
in an area on the cartoon based on what number that they are using for the
drop down list. For Example 2 would display in 2 and 2/4 would display in 4.
Unfortunately if I say 2 it displays in 2 if I say 2/4 it displays in 2 and
4 and I only want it to display in 4 not 2. Below is some code that I am
trying to use to allow that to happen but I think that I am missing
something. Can you help?

Dim sReturn As String

Select Case vsKettle

Case "2"
sReturn = "2"

Case "2/4"
sReturn = "4"

End Select


sjk153

Excel Question
 
Try adding additional variables in your code for each number. For example:

Dim sReturn As String
Dim a As Integer
Dim b As String
Dim C As Integer

a = 2
b = "2/4"
c = 4


Select Case vsKettle

Case a
sReturn = "2"

Case b
sReturn = "2/4"

Case c
sReturn = "4"
End Select




"Mindie" wrote:

I have a spreadsheet that I am working on where I define some of the
information in an area on the excel sheet (For example I have 1/2, 1, 2, 2/4,
3, 4, 4/5, 5, 5/6. These fields are used for a drop down list on the same
excel sheet and allow them to pick one of these numbers within that cell. I
then take the information from that cell and input it on a cartoon to display
in an area on the cartoon based on what number that they are using for the
drop down list. For Example 2 would display in 2 and 2/4 would display in 4.
Unfortunately if I say 2 it displays in 2 if I say 2/4 it displays in 2 and
4 and I only want it to display in 4 not 2. Below is some code that I am
trying to use to allow that to happen but I think that I am missing
something. Can you help?

Dim sReturn As String

Select Case vsKettle

Case "2"
sReturn = "2"

Case "2/4"
sReturn = "4"

End Select



All times are GMT +1. The time now is 05:01 PM.

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