I have worksheet("DATA") and in Column 'C' I have a long list of about 50 names. Some of the names have 'hyperlinks' that are linked to a web page and half of those names don't have a 'hyperlink'. I have a 'Userform'(DATA) with a current command button (see below example 1 that works) and I would like to change this command button so that I can set it to (enabled = false) and then when you go to an active cell in Column 'C' that has a 'hyperlink' the command button is (enabled=true) and when your in an active cell in Column 'C' that does not have a 'hyperlink' the command button is back to not (enabled=false).
This is where I need help. How do i combine these two examples to work? Below in example 2(not working) are some bits of code that I tried to get to work. I cannot figure out how to combined these two codes so the command button to checks the active cell in Column 'C' for the name that has a 'hyperlink' and then enables the button... HELP!
EXAMPLE 1
Private Sub cmboweb_Click()
Sheets("DATA").Select
If Selection.Hyperlinks.Count > 0 Then
Selection.Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
End If
End Sub
---------------------------------------
EXAMPLE 2
Private Sub cmboweb_Click()
If Selection.Hyperlinks.Count > 0 Then
cmboweb.Enabled = True
Else
cmboweb.Enabled = False
End If
End Sub
...or just a thought, would there be better to put code under the Userform_Activate to see if there is 'hyperlinks' in the Column 'C' and enable the command button?
I put this code under the Userform_Activate and it enables the command button but does not take it back to (false)?
If Selection.Hyperlinks.Count > 0 Then
Selection.Select
cmboweb.Enabled = True
Else
cmboweb.Enabled = False
End If
This is where I need help. How do i combine these two examples to work? Below in example 2(not working) are some bits of code that I tried to get to work. I cannot figure out how to combined these two codes so the command button to checks the active cell in Column 'C' for the name that has a 'hyperlink' and then enables the button... HELP!
EXAMPLE 1
Private Sub cmboweb_Click()
Sheets("DATA").Select
If Selection.Hyperlinks.Count > 0 Then
Selection.Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
End If
End Sub
---------------------------------------
EXAMPLE 2
Private Sub cmboweb_Click()
If Selection.Hyperlinks.Count > 0 Then
cmboweb.Enabled = True
Else
cmboweb.Enabled = False
End If
End Sub
...or just a thought, would there be better to put code under the Userform_Activate to see if there is 'hyperlinks' in the Column 'C' and enable the command button?
I put this code under the Userform_Activate and it enables the command button but does not take it back to (false)?
If Selection.Hyperlinks.Count > 0 Then
Selection.Select
cmboweb.Enabled = True
Else
cmboweb.Enabled = False
End If