PC Review


Reply
Thread Tools Rate Thread

add hyperlink without changing the cell formating

 
 
John
Guest
Posts: n/a
 
      23rd Sep 2011
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.
 
Reply With Quote
 
 
 
 
Jim Cone
Guest
Posts: n/a
 
      23rd Sep 2011
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" <(E-Mail Removed)>
wrote in message
news:5dda2fac-5f3b-4d99-8d14-(E-Mail Removed)...
> 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.



 
Reply With Quote
 
isabelle
Guest
Posts: n/a
 
      23rd Sep 2011
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.

 
Reply With Quote
 
isabelle
Guest
Posts: n/a
 
      23rd Sep 2011
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

 
Reply With Quote
 
Javed
Guest
Posts: n/a
 
      23rd Sep 2011
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"

 
Reply With Quote
 
John
Guest
Posts: n/a
 
      23rd Sep 2011
On Sep 22, 5:51*pm, John <jck.off...@gmail.com> 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!
 
Reply With Quote
 
isabelle
Guest
Posts: n/a
 
      24th Sep 2011
hi,

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

--
isabelle

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
changing the name of a hyperlink cell when copied =?Utf-8?B?QlJPQ0s4Mjky?= Microsoft Excel Misc 3 20th Sep 2007 11:40 PM
copying a cell and changing the formating from number to text =?Utf-8?B?TWFyayBHbG92ZXM=?= Microsoft Excel Misc 3 22nd Jun 2007 01:51 AM
Problem Changing Cell Formating SteveB Microsoft Excel Discussion 0 26th Apr 2006 12:38 PM
How to remove Hyperlink without changing cell format? =?Utf-8?B?SkFC?= Microsoft Excel Worksheet Functions 1 20th Jan 2006 07:08 PM
Changing the Hyperlink in a cell Michael Kintner Microsoft Excel Programming 2 24th Oct 2003 09:15 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:47 PM.