Hello,
I'm having some trouble getting an If…Then…Else Statement to work using multiple ElseIf conditions.
Currently, it will only take action on the first condition and none of the others.
I commented out the Else portion as according to M$, it's optional: If...Then...Else statement (VBA)
Any help would be greatly appreciated...
I'm having some trouble getting an If…Then…Else Statement to work using multiple ElseIf conditions.
Currently, it will only take action on the first condition and none of the others.
VBA Testing.xlsm | |||
---|---|---|---|
A | |||
1 | Digital Library | ||
2 | hoopladigital | ||
3 | openlibrary | ||
4 | lacountylibrary | ||
5 | GlendaleLAC | ||
If-Then-Else |
I commented out the Else portion as according to M$, it's optional: If...Then...Else statement (VBA)
VBA Code:
Public Sub dLibrary2()
'Digital Library Column
Dim Scheme As String, Domain As String, CloudDomain As String
Scheme = "https://"
Domain = ActiveCell.Value
CloudDomain = "https://ebook.yourcloudlibrary.com/library/"
'Validate Selection
If Len(Domain) > 0 Then
If Domain = "hoopladigital" Then ActiveCell.Hyperlinks.Add ActiveCell, Scheme & Domain & ".com", , , Domain
ElseIf Domain = "openlibrary" Then ActiveCell.Hyperlinks.Add ActiveCell, Scheme & Domain & ".org", , , Domain
ElseIf Domain = LCase(Domain) Then ActiveCell.Hyperlinks.Add ActiveCell, Scheme & Domain & ".overdrive.com", , , Domain
ElseIf Len(Domain) > 0 Then ActiveCell.Hyperlinks.Add ActiveCell, CloudDomain & Domain, , , Domain
'Else
End If
End Sub