Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Dennis You can try Tony's suggestion. or you can try this which fixes the error in your code. Please note that you do not need to select a workbook, worksheet, range etc to work with them - some example listed below your macro Sub Macro1() '1. Column reference will always be constant, rows will be variable '2. Find first non-zero length cell '3. Find the last cell with data '4. Select range '5. Make each value in selected range a working hyperlink Dim FirstRow As Long Dim LastRow As Long FirstRow = Worksheets("Sheet1").Range("a1").End(xlDown).Row + 1 ' this will give you the row of the 1st blank cell in A LastRow = Worksheets("Sheet1").Range("a65536").End(xlUp).Row + 1 ' this will give you the row of the last blank cell in A Dim myRange As Range Dim myVar As Range 'This is where I ran into trouble... Set myRange = Range("A" & FirstRow & ":A" & LastRow) 'set range 'Microsoft KB271856 For Each xCell In myRange ActiveSheet.Hyperlinks.Add Anchor:=xCell, Address:=xCell.Formula Next xCell End Sub range("a1").value = "Hi" workbooks("Book1").sheets(1).cells(1,1).value = "Hello" -- mudraker ------------------------------------------------------------------------ mudraker's Profile: http://www.excelforum.com/member.php...fo&userid=2473 View this thread: http://www.excelforum.com/showthread...hreadid=517527 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to define a charts range based on the value of a cell | Excel Discussion (Misc queries) | |||
Re-define a range in cells | Excel Programming | |||
Define a range based on another named range | Excel Worksheet Functions | |||
Define Range based on cell color | Excel Programming | |||
Define a Dynamic Range Based on an Index | Excel Programming |