Note: The other languages of the website are Google-translated. Back to English
Support is Offline
Today is our off day. We are taking some rest and will come back stronger tomorrow
Official support hours
Monday To Friday
From 09:00 To 17:30
  Wednesday, 24 November 2021
  3 Replies
  3.3K Visits
0
Votes
Undo
Please correct the  2nd code, both for the same worksheet.

FIRST CODE WORKING PERFECTLY
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("D1")) Is Nothing Then
Select Case Range("D1")
Case "0.5": Half
Case "1": One
Case "1.25": OneTwentyFive
End Select
End If
End Sub

SECOND CODE NOT WORKING (plz correct the below)
Private Sub Change(ByVal Target As Range)
If Not Intersect(Target, Range("D2")) Is Nothing Then
Select Case Range("D2")
Case "9.53": ninepointfivethree
End Select
End If
End Sub
10 months ago
·
#2357
0
Votes
Undo
Hi syedsalman,

For the same worksheet, you can the code:

Private Sub Worksheet_Change(ByVal Target As Range)


If Not Intersect(Target, Range("D1")) Is Nothing Then
Select Case Range("D1")
Case "0.5": Half
Case "1": One
Case "1.25": OneTwentyFive
End Select
End If

If Not Intersect(Target, Range("D2")) Is Nothing Then
Select Case Range("D2")
Case "9.53": ninepointfivethree
End Select
End If


End Sub


For different worksheets, you can just change "Private Sub Change(ByVal Target As Range)" in your second code to "Private Sub Worksheet_Change(ByVal Target As Range)".

Please try. Any questions please feel free to contact me.

Amanda
10 months ago
·
#2358
0
Votes
Undo
Its working now with your correction

thank you so much for the help :)
10 months ago
·
#2359
0
Votes
Undo
Its working now with your correction

thank you so much for the help :)

You are welcome. :)

Amanda
  • Page :
  • 1
There are no replies made for this post yet.