ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ListBox Question (https://www.excelbanter.com/excel-programming/298771-listbox-question.html)

RK[_2_]

ListBox Question
 
Can this be done?

I am trying to use a form with a listbox. So far I have
been unable to get the hyperlinks listed, only the
friendly name. I would like to list the friendly name,
but be able to click the friendly name and active the
hyperlink. (The reason, the hyperlink doesn't make any
sense to the normal user) The code I currently using is:
(I need to do other things to this as well, but I can't
go forward without resolving this.)

Has anyone done this?

Private Sub CommandButton2_Click()

Dim i As Long

For i = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) Then
Range(Me.ListBox1.List(i)).Parent.PrintOut
End If
Next i

End Sub

Private Sub frmUserForm1_Initialize()

Dim cell As Range

Me.ListBox1.ColumnCount = 2
Me.ListBox1.BoundColumn = 1
Me.ListBox1.ColumnWidths = "0;1"

For Each cell In Sheet1.Range("AC2:AC69").Cells
Me.ListBox1.AddItem cell.Hyperlinks(1).SubAddress
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 1) =
cell.Hyperlinks.TextToDisplay


Next cell
End Sub


Bob Phillips[_6_]

ListBox Question
 
Just because you rename the form, the event is still for Userform(sic!).

Private Sub UserForm_Initialize()

Dim cell As Range

Me.ListBox1.ColumnCount = 2
Me.ListBox1.BoundColumn = 1
Me.ListBox1.ColumnWidths = "0;1"

For Each cell In Sheet1.Range("AC2:AC69").Cells
Me.ListBox1.AddItem cell.Hyperlinks(1).SubAddress
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 1) =
cell.Hyperlinks(1).TextToDisplay


Next cell
End Sub



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"RK" wrote in message
...
Can this be done?

I am trying to use a form with a listbox. So far I have
been unable to get the hyperlinks listed, only the
friendly name. I would like to list the friendly name,
but be able to click the friendly name and active the
hyperlink. (The reason, the hyperlink doesn't make any
sense to the normal user) The code I currently using is:
(I need to do other things to this as well, but I can't
go forward without resolving this.)

Has anyone done this?

Private Sub CommandButton2_Click()

Dim i As Long

For i = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) Then
Range(Me.ListBox1.List(i)).Parent.PrintOut
End If
Next i

End Sub

Private Sub frmUserForm1_Initialize()

Dim cell As Range

Me.ListBox1.ColumnCount = 2
Me.ListBox1.BoundColumn = 1
Me.ListBox1.ColumnWidths = "0;1"

For Each cell In Sheet1.Range("AC2:AC69").Cells
Me.ListBox1.AddItem cell.Hyperlinks(1).SubAddress
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 1) =
cell.Hyperlinks.TextToDisplay


Next cell
End Sub




RK[_2_]

ListBox Question
 
I have a number of user forms, if I remove all of them
and only have two forms, frmMainMenu and UserForm it
still shows a blank ListBox.
??

Any other thoughts, thank for your help

RK


-----Original Message-----
Just because you rename the form, the event is still for

Userform(sic!).

Private Sub UserForm_Initialize()

Dim cell As Range

Me.ListBox1.ColumnCount = 2
Me.ListBox1.BoundColumn = 1
Me.ListBox1.ColumnWidths = "0;1"

For Each cell In Sheet1.Range("AC2:AC69").Cells
Me.ListBox1.AddItem cell.Hyperlinks(1).SubAddress
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 1) =
cell.Hyperlinks(1).TextToDisplay


Next cell
End Sub



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"RK" wrote in

message
...
Can this be done?

I am trying to use a form with a listbox. So far I have
been unable to get the hyperlinks listed, only the
friendly name. I would like to list the friendly name,
but be able to click the friendly name and active the
hyperlink. (The reason, the hyperlink doesn't make any
sense to the normal user) The code I currently using

is:
(I need to do other things to this as well, but I can't
go forward without resolving this.)

Has anyone done this?

Private Sub CommandButton2_Click()

Dim i As Long

For i = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) Then
Range(Me.ListBox1.List(i)).Parent.PrintOut
End If
Next i

End Sub

Private Sub frmUserForm1_Initialize()

Dim cell As Range

Me.ListBox1.ColumnCount = 2
Me.ListBox1.BoundColumn = 1
Me.ListBox1.ColumnWidths = "0;1"

For Each cell In Sheet1.Range("AC2:AC69").Cells
Me.ListBox1.AddItem cell.Hyperlinks(1).SubAddress
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 1) =
cell.Hyperlinks.TextToDisplay


Next cell
End Sub



.


Bob Phillips[_6_]

ListBox Question
 
Did you try the code I provided?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"RK" wrote in message
...
I have a number of user forms, if I remove all of them
and only have two forms, frmMainMenu and UserForm it
still shows a blank ListBox.
??

Any other thoughts, thank for your help

RK


-----Original Message-----
Just because you rename the form, the event is still for

Userform(sic!).

Private Sub UserForm_Initialize()

Dim cell As Range

Me.ListBox1.ColumnCount = 2
Me.ListBox1.BoundColumn = 1
Me.ListBox1.ColumnWidths = "0;1"

For Each cell In Sheet1.Range("AC2:AC69").Cells
Me.ListBox1.AddItem cell.Hyperlinks(1).SubAddress
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 1) =
cell.Hyperlinks(1).TextToDisplay


Next cell
End Sub



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"RK" wrote in

message
...
Can this be done?

I am trying to use a form with a listbox. So far I have
been unable to get the hyperlinks listed, only the
friendly name. I would like to list the friendly name,
but be able to click the friendly name and active the
hyperlink. (The reason, the hyperlink doesn't make any
sense to the normal user) The code I currently using

is:
(I need to do other things to this as well, but I can't
go forward without resolving this.)

Has anyone done this?

Private Sub CommandButton2_Click()

Dim i As Long

For i = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) Then
Range(Me.ListBox1.List(i)).Parent.PrintOut
End If
Next i

End Sub

Private Sub frmUserForm1_Initialize()

Dim cell As Range

Me.ListBox1.ColumnCount = 2
Me.ListBox1.BoundColumn = 1
Me.ListBox1.ColumnWidths = "0;1"

For Each cell In Sheet1.Range("AC2:AC69").Cells
Me.ListBox1.AddItem cell.Hyperlinks(1).SubAddress
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 1) =
cell.Hyperlinks.TextToDisplay


Next cell
End Sub



.




RK[_2_]

ListBox Question
 
RK
Yes, I did. I not sure why it doesn't work. I have been
working on this for 5 0r 6 weeks.
I have also looked for examples with hyperlinks, none
found. It shouldn't be this dificult. I can do a non-
hyperlink ListBox and it works fine.

Thank you for your help

RK

-----Original Message-----
Did you try the code I provided?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"RK" wrote in

message
...
I have a number of user forms, if I remove all of them
and only have two forms, frmMainMenu and UserForm it
still shows a blank ListBox.
??

Any other thoughts, thank for your help

RK


-----Original Message-----
Just because you rename the form, the event is still

for
Userform(sic!).

Private Sub UserForm_Initialize()

Dim cell As Range

Me.ListBox1.ColumnCount = 2
Me.ListBox1.BoundColumn = 1
Me.ListBox1.ColumnWidths = "0;1"

For Each cell In Sheet1.Range("AC2:AC69").Cells
Me.ListBox1.AddItem cell.Hyperlinks(1).SubAddress
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 1) =
cell.Hyperlinks(1).TextToDisplay


Next cell
End Sub



--

HTH

Bob Phillips
... looking out across Poole Harbour to the

Purbecks
(remove nothere from the email address if mailing

direct)

"RK" wrote in

message
...
Can this be done?

I am trying to use a form with a listbox. So far I

have
been unable to get the hyperlinks listed, only the
friendly name. I would like to list the friendly

name,
but be able to click the friendly name and active

the
hyperlink. (The reason, the hyperlink doesn't make

any
sense to the normal user) The code I currently using

is:
(I need to do other things to this as well, but I

can't
go forward without resolving this.)

Has anyone done this?

Private Sub CommandButton2_Click()

Dim i As Long

For i = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) Then
Range(Me.ListBox1.List(i)).Parent.PrintOut
End If
Next i

End Sub

Private Sub frmUserForm1_Initialize()

Dim cell As Range

Me.ListBox1.ColumnCount = 2
Me.ListBox1.BoundColumn = 1
Me.ListBox1.ColumnWidths = "0;1"

For Each cell In Sheet1.Range("AC2:AC69").Cells
Me.ListBox1.AddItem cell.Hyperlinks

(1).SubAddress
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 1) =
cell.Hyperlinks.TextToDisplay


Next cell
End Sub



.



.


Bob Phillips[_6_]

ListBox Question
 
How about cutting to the quick and send me the workbook, and I'll see what I
can do

bob[dot]phillips[at]tiscali[dot]co[dot]uk

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"RK" wrote in message
...
RK
Yes, I did. I not sure why it doesn't work. I have been
working on this for 5 0r 6 weeks.
I have also looked for examples with hyperlinks, none
found. It shouldn't be this dificult. I can do a non-
hyperlink ListBox and it works fine.

Thank you for your help

RK

-----Original Message-----
Did you try the code I provided?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"RK" wrote in

message
...
I have a number of user forms, if I remove all of them
and only have two forms, frmMainMenu and UserForm it
still shows a blank ListBox.
??

Any other thoughts, thank for your help

RK


-----Original Message-----
Just because you rename the form, the event is still

for
Userform(sic!).

Private Sub UserForm_Initialize()

Dim cell As Range

Me.ListBox1.ColumnCount = 2
Me.ListBox1.BoundColumn = 1
Me.ListBox1.ColumnWidths = "0;1"

For Each cell In Sheet1.Range("AC2:AC69").Cells
Me.ListBox1.AddItem cell.Hyperlinks(1).SubAddress
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 1) =
cell.Hyperlinks(1).TextToDisplay


Next cell
End Sub



--

HTH

Bob Phillips
... looking out across Poole Harbour to the

Purbecks
(remove nothere from the email address if mailing

direct)

"RK" wrote in
message
...
Can this be done?

I am trying to use a form with a listbox. So far I

have
been unable to get the hyperlinks listed, only the
friendly name. I would like to list the friendly

name,
but be able to click the friendly name and active

the
hyperlink. (The reason, the hyperlink doesn't make

any
sense to the normal user) The code I currently using
is:
(I need to do other things to this as well, but I

can't
go forward without resolving this.)

Has anyone done this?

Private Sub CommandButton2_Click()

Dim i As Long

For i = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) Then
Range(Me.ListBox1.List(i)).Parent.PrintOut
End If
Next i

End Sub

Private Sub frmUserForm1_Initialize()

Dim cell As Range

Me.ListBox1.ColumnCount = 2
Me.ListBox1.BoundColumn = 1
Me.ListBox1.ColumnWidths = "0;1"

For Each cell In Sheet1.Range("AC2:AC69").Cells
Me.ListBox1.AddItem cell.Hyperlinks

(1).SubAddress
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 1) =
cell.Hyperlinks.TextToDisplay


Next cell
End Sub



.



.




RK[_2_]

ListBox Question
 
RK
Thank you for your help . . . .

RK

-----Original Message-----
How about cutting to the quick and send me the workbook,

and I'll see what I
can do

bob[dot]phillips[at]tiscali[dot]co[dot]uk

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"RK" wrote in

message
...
RK
Yes, I did. I not sure why it doesn't work. I have been
working on this for 5 0r 6 weeks.
I have also looked for examples with hyperlinks, none
found. It shouldn't be this dificult. I can do a non-
hyperlink ListBox and it works fine.

Thank you for your help

RK

-----Original Message-----
Did you try the code I provided?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the

Purbecks
(remove nothere from the email address if mailing

direct)

"RK" wrote in

message
...
I have a number of user forms, if I remove all of

them
and only have two forms, frmMainMenu and UserForm it
still shows a blank ListBox.
??

Any other thoughts, thank for your help

RK


-----Original Message-----
Just because you rename the form, the event is

still
for
Userform(sic!).

Private Sub UserForm_Initialize()

Dim cell As Range

Me.ListBox1.ColumnCount = 2
Me.ListBox1.BoundColumn = 1
Me.ListBox1.ColumnWidths = "0;1"

For Each cell In Sheet1.Range("AC2:AC69").Cells
Me.ListBox1.AddItem cell.Hyperlinks

(1).SubAddress
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 1)

=
cell.Hyperlinks(1).TextToDisplay


Next cell
End Sub



--

HTH

Bob Phillips
... looking out across Poole Harbour to the

Purbecks
(remove nothere from the email address if mailing

direct)

"RK" wrote in
message
...
Can this be done?

I am trying to use a form with a listbox. So far

I
have
been unable to get the hyperlinks listed, only

the
friendly name. I would like to list the friendly

name,
but be able to click the friendly name and active

the
hyperlink. (The reason, the hyperlink doesn't

make
any
sense to the normal user) The code I currently

using
is:
(I need to do other things to this as well, but I

can't
go forward without resolving this.)

Has anyone done this?

Private Sub CommandButton2_Click()

Dim i As Long

For i = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) Then
Range(Me.ListBox1.List

(i)).Parent.PrintOut
End If
Next i

End Sub

Private Sub frmUserForm1_Initialize()

Dim cell As Range

Me.ListBox1.ColumnCount = 2
Me.ListBox1.BoundColumn = 1
Me.ListBox1.ColumnWidths = "0;1"

For Each cell In Sheet1.Range("AC2:AC69").Cells
Me.ListBox1.AddItem cell.Hyperlinks

(1).SubAddress
Me.ListBox1.List(Me.ListBox1.ListCount - 1,

1) =
cell.Hyperlinks.TextToDisplay


Next cell
End Sub



.



.



.


RK[_2_]

ListBox Question
 
Did you see where I messed up

RK

Bob Phillips[_6_]

ListBox Question
 
I haven't received anything yet. Try again.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"RK" wrote in message
...
Did you see where I messed up?

RK




RK[_2_]

ListBox Question
 
Sent again

Thank you again. I have been unable to find ANY information on hyperlinks, and I have spent many many hours looking

RK


All times are GMT +1. The time now is 02:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com