Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Appending Hyperlink to existing text at certain start row

Ok my code works great except I need to start at row 11, I am not sure
how to keep it so I am only going through the current range of column
a and to be able to start at a specified row
Here is my code:
Sub TextWithAppendedHyperlink()
Dim cell As Range
Dim txt$, url$
Dim colorTxt, colorUrl&

For Each cell In Worksheets(1).UsedRange.Columns(1).Cells
If cell < "" And cell.Offset(0, 11).Value < "" Then '
url = cell.Offset(0, 11).Value '"http://www.google.com"
colorUrl = ActiveWorkbook.Styles("Hyperlink").Font.Color
cell.Hyperlinks.Add _
Anchor:=cell, Address:= _
url, TextToDisplay:=Trim(cell.Value)
End If
Next
End Sub

Thanks for any help, It is much appreciated!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Appending Hyperlink to existing text at certain start row

Matt,

Try something like this:

Sub Test()
Dim c As Range
Dim iColStart As Integer
Dim iColEnd As Integer
Dim lRowStart As Long
Dim lRowEnd As Long
Dim rng As Range

With Sheet1.UsedRange
lRowEnd = .SpecialCells(xlCellTypeLastCell).Row 'Get the last row
If lRowEnd = 11 Then 'Row 11 and above has data. keep going
lRowStart = 11 'Start from Row 11
iColStart = .Column 'Get the starting column
iColEnd = .SpecialCells(xlCellTypeLastCell).Column 'Get the last
column
Set rng = Range(Cells(lRowStart, iColStart), Cells(lRowEnd,
iColEnd))
For Each c In rng
If c.Value < "" Then
'**************
'YOUR CODE HERE
'**************
End If
Next c
End If
End With
Set rng = Nothing
Set c = Nothing
End Sub



"Matt Pierringer" wrote:

Ok my code works great except I need to start at row 11, I am not sure
how to keep it so I am only going through the current range of column
a and to be able to start at a specified row
Here is my code:
Sub TextWithAppendedHyperlink()
Dim cell As Range
Dim txt$, url$
Dim colorTxt, colorUrl&

For Each cell In Worksheets(1).UsedRange.Columns(1).Cells
If cell < "" And cell.Offset(0, 11).Value < "" Then '
url = cell.Offset(0, 11).Value '"http://www.google.com"
colorUrl = ActiveWorkbook.Styles("Hyperlink").Font.Color
cell.Hyperlinks.Add _
Anchor:=cell, Address:= _
url, TextToDisplay:=Trim(cell.Value)
End If
Next
End Sub

Thanks for any help, It is much appreciated!


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Appending to existing function D.Jessup Excel Worksheet Functions 4 November 26th 06 10:43 AM
Appending to a cell content loses existing data formatting DejaUser Excel Programming 0 January 31st 06 08:01 PM
appending text to existing values anny Excel Worksheet Functions 3 January 28th 06 06:24 PM
Appending to a Cell doesn't keep format of existing content DejaUser Excel Programming 3 January 25th 06 09:43 PM
Appending external worksheets into existing workbook? Xuratoth Links and Linking in Excel 5 October 4th 05 12:48 PM


All times are GMT +1. The time now is 02:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"