Consulting

Results 1 to 6 of 6

Thread: check for hyperlink

  1. #1
    VBAX Newbie
    Joined
    Dec 2006
    Posts
    5
    Location

    Smile check for hyperlink

    Hi! VBA experts,Could you help how to check or validate if a particular cell value has a hyperlink or not? My current excel worksheet has about 6,000 rows with two 12 columns(sort of a table). Column A has 6,000 rows with some values on cells has hyperlink. I just want to search for cells that has hyperlinks.Thanks.Hamz

  2. #2
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    Hi there and welcome to the board!

    The real question here is: what do you want to do with them? Do you want a formula to return a boolean (TRUE/FALSE) result? Do you want to select all hyperlinks? Do you want to do something else with them? Do you want to remove the hyperlinks? What about HYPERLINK() formulas?

  3. #3
    VBAX Newbie
    Joined
    Dec 2006
    Posts
    5
    Location

    VB inquiry

    Actually, your all your questions were valid. Yes, i want a True or False return, and if true a command button will enable and allow the user to click itto view the hyperlink file. And if false a command button will enable and whenclicked promt the user to delete it or not.Any suggesttions?

  4. #4
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    How are you intending to identify the particular cell to be checked?
    Your seem to be asking two separate questions here, Post #3 seems relevant to Q1, but not Q2. What do you intend with found cells from Q2?
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  5. #5
    How would you get a boolean (TRUE/FALSE) result as to whether or not a particular cell contains a hyperlink?

    My current (non-boolean) test is:
    linkAddress = .Cells(xstart, I).Hyperlinks.SubAddress

    but it errors with

    Runtime error 438
    Object doesn't support this property or method

    when it encounters a cell with no hyperlink.

    David

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Try this

    [vba]

    MsgBox ActiveCell.Hyperlinks.Count > 0
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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