Shei7141
Shei7141

Reputation: 15

change TEXT to display in excel via vba

Is there a way to change the text to display of all the hyperlinks in a sheet?

All I want to do it is run a macro to trim the the existing TEXT to Display to 5 chrs only? At the mo, my text to display is really big text string something like "21253.bla bla bla.wla wla wla. dah dah dah.jpg" and I only want to display 21253

Is this even possible? Regards Shei

Upvotes: 0

Views: 1996

Answers (1)

Sorceri
Sorceri

Reputation: 8033

Loop through the links on the sheets and use the left function to trim the text to display. Example below

Dim hl As Hyperlink
For Each hl In ActiveSheet.Hyperlinks
    hl.TextToDisplay = Left(hl.TextToDisplay, 5)
Next

Upvotes: 1

Related Questions