VBA Not working help improve

SanjayGulatiMusafir

Board Regular
Joined
Sep 7, 2018
Messages
66
Dear Experts
I wrote a VBA copy bits from here and there. It worked fine, the day I created, But now it's giving continuous error. It stops at the Red highlighted point and gives error. Can you help me find the error and improve. Thanks a lot ?

Rich (BB code):
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)


    If Target.Name = "Astro - Dosha/Yoga" Then
    Call YogaSort
    Else
    
    If Target.Name = "Astro - Remedies/Gems" Then
    Call RemediesSort
    Else
    
    If Target.Name = "Astro - Prashna" Then
    Call PrashnaSort
    Else
    
    If Target.Name = "Astro - Events" Then
    Call EventsSort
    Else
    
    If Target.Name = "Astro - Muhurata" Then
    Call MuhurataSort
    Else
    
    If Target.Name = "Info - Spriha Sanjay" Then
    Call SprEventsSort
    Else
    
    If Target.Name = "Astro - Mundane" Then
    Call MundaneSort
    Else
    
    If Target.Name = "Astro - Games" Then
    Call GamesSort
    Else
    Do Nothing
    End If
    
End Sub
 

Some videos you may like

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,762
Office Version
2013
Platform
Windows
I would think it should be If Target.value=

Or is this a actual named range?

I do not believe that is a proper named Range.
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
18,963
Office Version
2013
Platform
Windows
Try it this way....

Code:
Private Sub Workbook_SheetFollowHyperlink(ByVal Target As Hyperlink)
    If Target.Name = "Astro - Dosha/Yoga" Then Call YogaSort
    If Target.Name = "Astro - Remedies/Gems" Then Call RemediesSort
    If Target.Name = "Astro - Prashna" Then Call PrashnaSort
    If Target.Name = "Astro - Events" Then Call EventsSort
    If Target.Name = "Astro - Muhurata" Then Call MuhurataSort
    If Target.Name = "Info - Spriha Sanjay" Then Call SprEventsSort
    If Target.Name = "Astro - Mundane" Then Call MundaneSort
    If Target.Name = "Astro - Games" Then Call GamesSort
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,102,335
Messages
5,486,233
Members
407,538
Latest member
kbendelac

This Week's Hot Topics

Top