add hyperlink without changing the cell formating

J

John

In a macro I am adding hyperlinks using the following code:

Cells(i, "H").Select ActiveSheet.Hyperlinks.Add Anchor:=Selection,
Address:="http://blahblahbla"

Is it possible to add a hyperlink in this fashion without changing the
formating of cell?

Thanks for looking.
 
J

Jim Cone

You could change the hyperlink "style" for the workbook.
That would have to be repeated for each workbook.
-or-
Add a couple lines of code to your existing code...
ActiveCell.Font.Underline = xlUnderlineStyleNone
ActiveCell.Font.ColorIndex = xlColorIndexAutomatic
--
Jim Cone
Portland, Oregon USA .
http://www.mediafire.com/PrimitiveSoftware .
(Extras for Excel add-in: convenience built-in)





"John" <[email protected]>
wrote in message
news:5dda2fac-5f3b-4d99-8d14-03925afb9af1@dq7g2000vbb.googlegroups.com...
 
I

isabelle

hi,

With ActiveSheet
With .Cells(i, "H")
.Hyperlinks.Add .Cells(i, "H"), "http://www.google.ca/"
With .Font
.Name = "Arial"
.Size = 16
.Underline = xlUnderlineStyleNone 'StyleSingle, StyleDouble
.ColorIndex = 0
.Italic = True
End With
End With
End With


--
isabelle



Le 2011-09-22 19:51, John a écrit :
 
I

isabelle

it will be easier to read like this

With ActiveSheet
.Hyperlinks.Add .Cells(i, "H"), "http://www.google.ca/"
With .Cells(i, "H").Font
.Name = "Arial"
.Size = 16
.Underline = xlUnderlineStyleNone
.ColorIndex = 0
.Italic = True
End With
End With
 
J

Javed

Use the following:

The application object has a property
(Application.AutoFormatAsYouTypeReplaceHyperlinks )which decides
whether excel will replace the formatting of the cell where one URL or
mail id present

The advantage is that it will be applicable for all such cell.You need
not change the font of all cell containing the URL/Mail Id.


Application.AutoFormatAsYouTypeReplaceHyperlinks=False
Activesheet.Hyperlinks.Add anchor:=range("H:"&i),Address:="http://
blahblahbla"
 
J

John

In a macro I am adding hyperlinks using the following code:

Thank you for all the responses thus far. I will experiment with the
suggestions soon. In addition to teh font color and underline I have
seen in my case that the vertical alignment is also changed, makes me
wonder how many other parameters are changed when adding a hyperlink.

Before I posted my inquiry I did do a internet search on the question
and I came across the following discussion which had some promise but
I did not get enough detail from the discussion to make any progress.
The process described in this discussion looks ideal, if anyone can
shed some insight on how to make it work that would be of interest
also.

http://www.vbforums.com/showthread.php?t=431152

Have a good day all!
 
I

isabelle

hi,

use the macro recorder and manually make the changes you are interested and then examine the code
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Insert Hyperlink 4
Create Hyperlink in VBA 7
Run Hyperlink by forms button 2
hyperlink creation problem 1
Hyperlink macro for personal.xls 5
Help with loop 1
Hyperlinking cells and macros 2
Hyperlink 3

Top