How can I copy a hyperlink cell value to a userform label cell?

edpruiz

New Member
Joined
Oct 4, 2021
Messages
4
Office Version
  1. 365
Platform
  1. Windows
I´m doing an userform to fill a database, but my code doesn´t work for a label cell
All my code works efficiently, except for a part related to a hyperlink tag

I would appreciate if you could help me by finding my error, and giving me options to solve it

This is my code, the problem is on the LB1 line, I do not know the code with which I can replace "text"


Private Sub BC3_Click()
Dim cust_id As String
cust_id = Trim(T1.Text)
lastrow = Worksheets("Oficios Enviados").Cells(Rows.Count, 1).End(xlUp).Row
For i = 3 To lastrow
If Worksheets("Oficios Enviados").Cells(i, 2).Value = cust_id Then

CB1.Text = Worksheets("Oficios Enviados").Cells(i, 3).Value
T2.Text = Worksheets("Oficios Enviados").Cells(i, 4).Value
T3.Text = Worksheets("Oficios Enviados").Cells(i, 5).Value
T4.Text = Worksheets("Oficios Enviados").Cells(i, 6).Value
T5.Text = Worksheets("Oficios Enviados").Cells(i, 7).Value
T6.Text = Worksheets("Oficios Enviados").Cells(i, 8).Value
T7.Text = Worksheets("Oficios Enviados").Cells(i, 9).Value
T8.Text = Worksheets("Oficios Enviados").Cells(i, 10).Value
T9.Text = Worksheets("Oficios Enviados").Cells(i, 11).Value
T10.Text = Worksheets("Oficios Enviados").Cells(i, 12).Value
T11.Text = Worksheets("Oficios Enviados").Cells(i, 13).Value
T12.Text = Worksheets("Oficios Enviados").Cells(i, 14).Value
T13.Text = Worksheets("Oficios Enviados").Cells(i, 15).Value
T14.Text = Worksheets("Oficios Enviados").Cells(i, 16).Value
T15.Text = Worksheets("Oficios Enviados").Cells(i, 17).Value
LB1.Text = Worksheets("Oficios Enviados").Cells(i, 18).Caption
CB2.Text = Worksheets("Oficios Enviados").Cells(i, 19).Value
T16.Text = Worksheets("Oficios Enviados").Cells(i, 20).Value
End If
Next
End Sub
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

SQUIDD

Well-known Member
Joined
Jan 2, 2009
Messages
1,936
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
LB1.caption= Worksheets("Oficios Enviados").Cells(i, 18).Caption

?
 

edpruiz

New Member
Joined
Oct 4, 2021
Messages
4
Office Version
  1. 365
Platform
  1. Windows
LB1.caption= Worksheets("Oficios Enviados").Cells(i, 18).Caption

?
Thanks
I tried that but it didn't work either
1633372600205.png
 

SQUIDD

Well-known Member
Joined
Jan 2, 2009
Messages
1,936
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
What are you trying to achieve here.

looking at this properly now,

LB1.caption= Worksheets("Oficios Enviados").Cells(i, 18).text

this will pull in the text from that cell

are you hoping to get a hyperlink in the caption you can click to follow?

Dave
 
Solution

edpruiz

New Member
Joined
Oct 4, 2021
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Thanks that "text" at the end of the command was what was wrong
 

SQUIDD

Well-known Member
Joined
Jan 2, 2009
Messages
1,936
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Glad its resolved for you
 

Forum statistics

Threads
1,148,194
Messages
5,745,276
Members
423,942
Latest member
excelhelp1423

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top