Modifying CASE function in VBA code
Closed
sell1
Posts
1
Registration date
Friday August 10, 2018
Status
Member
Last seen
August 10, 2018
-
Updated on Aug 10, 2018 at 04:56 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Aug 23, 2018 at 11:31 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Aug 23, 2018 at 11:31 AM
Related:
- Modifying CASE function in VBA code
- Vba case like - Guide
- Battery reset code - Guide
- Samsung volume increase code - Guide
- Cs 1.6 code - Guide
- How to get whatsapp verification code online - Guide
2 responses
Try this:
CellA3 = ThisWorkbook.Worksheets("Sheet1").Range("A3").value
Select Case CellA3
Case "here"
do something
Case "there"
do something
End Select
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Aug 14, 2018 at 11:44 AM
Aug 14, 2018 at 11:44 AM
Hi Sell1,
Seems to me that the Select CASE method is not the right one for you, since your suggestion doesn't make sense.
Select Case Cl
Case "John"
dCell.Interior.ColorIndex = 27
Means, look at the value CI, when it is "John", then change dCell color.
Since a value can never be the same as a location, it doesn't make sense to change "John" into Range("A3").
Could you explain what you are trying to achieve?
Best regards,
Trowa
Seems to me that the Select CASE method is not the right one for you, since your suggestion doesn't make sense.
Select Case Cl
Case "John"
dCell.Interior.ColorIndex = 27
Means, look at the value CI, when it is "John", then change dCell color.
Since a value can never be the same as a location, it doesn't make sense to change "John" into Range("A3").
Could you explain what you are trying to achieve?
Best regards,
Trowa
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Aug 16, 2018 at 11:08 AM
Aug 16, 2018 at 11:08 AM
And I'm trying to figure out what OP wants, since it can be hard to figure out what structure to use, when you are not aware of which ones are out there.
What is the point of answering literally when you know OP is not being helped by it?
To each their own method I guess.
What is the point of answering literally when you know OP is not being helped by it?
To each their own method I guess.
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Aug 21, 2018 at 11:55 AM
Aug 21, 2018 at 11:55 AM
Good point. I just think (guess) that most posters aren't here to learn or get proficient at what they are asking about. So I (try to) provide a solution and when they want to know/learn more, because they are interested, they can ask for it.