VBA Not working help improve
Results 1 to 3 of 3

Thread: VBA Not working help improve
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Sep 2018
    Location
    New Delhi, India
    Posts
    53
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default VBA Not working help improve

    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 🙏

    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

  2. #2
    Board Regular My Aswer Is This's Avatar
    Join Date
    Jul 2014
    Posts
    15,686
    Post Thanks / Like
    Mentioned
    28 Post(s)
    Tagged
    13 Thread(s)

    Default Re: VBA Not working help improve

    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.
    Be sure and always test this script on sample data the first time you use this as to avoid any problems with your data. Always trying to learn more and help others where I can. I'm using Excel 2013.
    Patience please I’m not perfect yet. "Memories are forever"

  3. #3
    Board Regular Michael M's Avatar
    Join Date
    Oct 2005
    Location
    South Western NSW
    Posts
    17,545
    Post Thanks / Like
    Mentioned
    18 Post(s)
    Tagged
    2 Thread(s)

    Default Re: VBA Not working help improve

    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
    Regards
    Michael M
    ---------------------------------------
    The more I learn, the less I seem to know.....A Please and Thank You cost nothing !
    It's easier to debug if we can see the whole macro !
    Home 2007 & 2013

    - Posting guidelines, forum rules and terms of use

    - To download Mr Excel HTML Maker

    - Try searching for your answer first, see how

    - Read the FAQs

    - List of BB codes


    [CODE]Place Your Code Here[/CODE]

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •