Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default 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
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
Using a txt string to refer to other work book CC-Khriz Excel Worksheet Functions 0 January 26th 06 01:20 PM
variable to refer to "this worksheet"? confused Excel Worksheet Functions 1 June 16th 05 11:51 PM
Using a variable to refer a cell jeam Excel Programming 1 February 13th 05 03:25 PM
How to refer to controls by string Darren Hill[_2_] Excel Programming 3 January 27th 04 03:29 AM
How to refer a Variable across Workbooks ? Prabhu Dev Excel Programming 1 November 27th 03 05:22 AM


All times are GMT +1. The time now is 01:17 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"