MasterBash
Board Regular
- Joined
- Jan 22, 2022
- Messages
- 68
- Office Version
- 365
- Platform
- Windows
Hello,
I currently have this :
What it does :
When I click on a link in the third column (C), it calls Send_The_Emails.
What I am trying to do :
Have 2 different "If... End if" depending on which row I choose to click in the C column.
Something like this :
If I click C1 to C24, then it must call Send_The_Emails_1 and if I click C26 to C28, it must call Send_The_Emails_2
Well, I am posting here because it doesn't work. The "If... Then" seems incorrect because it doesn't do anything. The first script works fine.
Can anyone please help me out ? Thank you.
I currently have this :
VBA Code:
Option Explicit
Dim location As String
Dim subject As String
Dim body As String
Dim email As String
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
If Range(Target.SubAddress).Column = 3 Then
location = Range("B" & Range(Target.SubAddress).Row).Value
email = Range("G1")
subject = Range("G2") & location
body = Range("G3") & location & Range("H3")
Call Send_The_Emails
End If
End Sub
What it does :
When I click on a link in the third column (C), it calls Send_The_Emails.
What I am trying to do :
Have 2 different "If... End if" depending on which row I choose to click in the C column.
Something like this :
VBA Code:
Option Explicit
Dim location As String
Dim subject As String
Dim body As String
Dim email As String
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
If Range(Target.SubAddress) = "C1;C24" Then
location = Range("B" & Range(Target.SubAddress).Row).Value
email = Range("G1")
subject = Range("G2") & location
body = Range("G3") & location & Range("H3")
Call Send_The_Emails_1
End If
If Range(Target.SubAddress) = "C26;C28" Then
location = Range("B" & Range(Target.SubAddress).Row).Value
email = Range("F26")
subject = Range("F27") & location
body = Range("F28")
Call Send_The_Emails_2
End If
End Sub
If I click C1 to C24, then it must call Send_The_Emails_1 and if I click C26 to C28, it must call Send_The_Emails_2
Well, I am posting here because it doesn't work. The "If... Then" seems incorrect because it doesn't do anything. The first script works fine.
Can anyone please help me out ? Thank you.