Modifying CASE function in VBA code
Closed
sell1
Posts
1
Registration date
Friday 10 August 2018
Status
Member
Last seen
10 August 2018
-
10 Aug 2018 à 08:58
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 - 23 Aug 2018 à 11:31
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 - 23 Aug 2018 à 11:31
Related:
- Modifying CASE function in VBA code
- Vba case like - Guide
- Vba find function - Guide
- Hard drive function - Guide
- Cs 1.6 code - Guide
- Network card function - 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 12 September 2010
Status
Contributor
Last seen
27 December 2022
555
14 Aug 2018 à 11:44
14 Aug 2018 à 11:44
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 12 September 2010
Status
Contributor
Last seen
27 December 2022
555
16 Aug 2018 à 11:08
16 Aug 2018 à 11:08
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 12 September 2010
Status
Contributor
Last seen
27 December 2022
555
21 Aug 2018 à 11:55
21 Aug 2018 à 11:55
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.