Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to refer variable while assigning string value?
--------
Dim counter As Integer counter = 1 For Each linkcell In Sheets("My report").Range("B63:B106") ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _ "Folder/Aprofiles_" & CStr(counter) ".txt", TextToDisplay:="Aprofiles__" &CStr(counter) ".txt" counter = counter + 1 Next linkcell End Sub -------- The files available under the 'Folder' are as follows: Aprofiles_1.txt Aprofiles_2.txt Aprofiles_3.txt ............... I want to create the links to each of them in each of the cells in the range "B63:B106". The assignment of "Folder/Aprofiles_" & CStr(counter) ".txt" does not work. How exactly I can refer a variable while assigning the string value? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to refer variable while assigning string value?
Hi
Please use like this "Folder/Aprofiles_" & CStr(counter) & ".txt" you missed one & Thanks Xcelion " wrote: -------- Dim counter As Integer counter = 1 For Each linkcell In Sheets("My report").Range("B63:B106") ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _ "Folder/Aprofiles_" & CStr(counter) ".txt", TextToDisplay:="Aprofiles__" &CStr(counter) ".txt" counter = counter + 1 Next linkcell End Sub -------- The files available under the 'Folder' are as follows: Aprofiles_1.txt Aprofiles_2.txt Aprofiles_3.txt ............... I want to create the links to each of them in each of the cells in the range "B63:B106". The assignment of "Folder/Aprofiles_" & CStr(counter) ".txt" does not work. How exactly I can refer a variable while assigning the string value? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Using a txt string to refer to other work book | Excel Worksheet Functions | |||
variable to refer to "this worksheet"? | Excel Worksheet Functions | |||
Using a variable to refer a cell | Excel Programming | |||
How to refer to controls by string | Excel Programming | |||
How to refer a Variable across Workbooks ? | Excel Programming |