#1   Report Post  
Greg B
 
Posts: n/a
Default Please Help

I got help from some one last night and they gave me this code

Private Sub ListBox1_Click()
Dim rng as Range
If listbox1.ListIndex < -1 then
set rng = Range(Listbox1.Value)
if rng.hyperlinks.count 0 then
rng.select
rng.parent.parent.FollowHyperlink rng.hyperlinks(1).Address, _
rng.Hyperlinks(1).SubAddress, True
end if
End If
End Sub

The trouble I am having it is coming up with the error,

Run-time error '1004':
Method 'range' of object_global failed

I was asked how I populated the listbox and this is how I did it

Private Sub UserForm_Activate()
ListBox1.RowSource = "a:e"
End Sub

Where am I going wrong?

Thanks
Greg


  #2   Report Post  
Ian
 
Posts: n/a
Default

AFAIK RowSource needs to be more explicit eg "a1:e4"

--
Ian
--
"Greg B" wrote in message
...
I got help from some one last night and they gave me this code

Private Sub ListBox1_Click()
Dim rng as Range
If listbox1.ListIndex < -1 then
set rng = Range(Listbox1.Value)
if rng.hyperlinks.count 0 then
rng.select
rng.parent.parent.FollowHyperlink rng.hyperlinks(1).Address, _
rng.Hyperlinks(1).SubAddress, True
end if
End If
End Sub

The trouble I am having it is coming up with the error,

Run-time error '1004':
Method 'range' of object_global failed

I was asked how I populated the listbox and this is how I did it

Private Sub UserForm_Activate()
ListBox1.RowSource = "a:e"
End Sub

Where am I going wrong?

Thanks
Greg



  #3   Report Post  
Greg B
 
Posts: n/a
Default

Thanks will try

"Ian" wrote in message
...
AFAIK RowSource needs to be more explicit eg "a1:e4"

--
Ian
--
"Greg B" wrote in message
...
I got help from some one last night and they gave me this code

Private Sub ListBox1_Click()
Dim rng as Range
If listbox1.ListIndex < -1 then
set rng = Range(Listbox1.Value)
if rng.hyperlinks.count 0 then
rng.select
rng.parent.parent.FollowHyperlink rng.hyperlinks(1).Address, _
rng.Hyperlinks(1).SubAddress, True
end if
End If
End Sub

The trouble I am having it is coming up with the error,

Run-time error '1004':
Method 'range' of object_global failed

I was asked how I populated the listbox and this is how I did it

Private Sub UserForm_Activate()
ListBox1.RowSource = "a:e"
End Sub

Where am I going wrong?

Thanks
Greg





  #4   Report Post  
Greg B
 
Posts: n/a
Default

Sorry that didn't work any more ideas?

Thanks
Greg
"Greg B" wrote in message
...
Thanks will try

"Ian" wrote in message
...
AFAIK RowSource needs to be more explicit eg "a1:e4"

--
Ian
--
"Greg B" wrote in message
...
I got help from some one last night and they gave me this code

Private Sub ListBox1_Click()
Dim rng as Range
If listbox1.ListIndex < -1 then
set rng = Range(Listbox1.Value)
if rng.hyperlinks.count 0 then
rng.select
rng.parent.parent.FollowHyperlink rng.hyperlinks(1).Address, _
rng.Hyperlinks(1).SubAddress, True
end if
End If
End Sub

The trouble I am having it is coming up with the error,

Run-time error '1004':
Method 'range' of object_global failed

I was asked how I populated the listbox and this is how I did it

Private Sub UserForm_Activate()
ListBox1.RowSource = "a:e"
End Sub

Where am I going wrong?

Thanks
Greg







  #5   Report Post  
Greg B
 
Posts: n/a
Default

I have worked it out all I did was the following code. I think I was
thinking too complicated for what i needed.

Private Sub ListBox1_Click()

ActiveSheet.Range("A1").Offset(ListBox1.ListIndex) .Select

Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True


End Sub
Thanks
Greg
"Greg B" wrote in message
...
Sorry that didn't work any more ideas?

Thanks
Greg
"Greg B" wrote in message
...
Thanks will try

"Ian" wrote in message
...
AFAIK RowSource needs to be more explicit eg "a1:e4"

--
Ian
--
"Greg B" wrote in message
...
I got help from some one last night and they gave me this code

Private Sub ListBox1_Click()
Dim rng as Range
If listbox1.ListIndex < -1 then
set rng = Range(Listbox1.Value)
if rng.hyperlinks.count 0 then
rng.select
rng.parent.parent.FollowHyperlink rng.hyperlinks(1).Address, _
rng.Hyperlinks(1).SubAddress, True
end if
End If
End Sub

The trouble I am having it is coming up with the error,

Run-time error '1004':
Method 'range' of object_global failed

I was asked how I populated the listbox and this is how I did it

Private Sub UserForm_Activate()
ListBox1.RowSource = "a:e"
End Sub

Where am I going wrong?

Thanks
Greg











Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"