ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   add hyperlink without changing the cell formating (https://www.excelbanter.com/excel-programming/444974-add-hyperlink-without-changing-cell-formating.html)

John[_139_]

add hyperlink without changing the cell formating
 
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.

Jim Cone[_2_]

add hyperlink without changing the cell formating
 
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"
wrote in message
...
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.




isabelle

add hyperlink without changing the cell formating
 
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 :
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.


isabelle

add hyperlink without changing the cell formating
 
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

--
isabelle


Javed

add hyperlink without changing the cell formating
 
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=F alse
Activesheet.Hyperlinks.Add anchor:=range("H:"&i),Address:="http://
blahblahbla"


John[_139_]

add hyperlink without changing the cell formating
 
On Sep 22, 5:51*pm, John wrote:
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!

isabelle

add hyperlink without changing the cell formating
 
hi,

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

--
isabelle



All times are GMT +1. The time now is 07:05 AM.

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