I am creating a vba For loop to cycle through cells in a range and creating a hyperlink to file folders based on the text within the cell. See below:
Set rng = Worksheets("Sheet1").Range("A1:A100")
For Each cell In rng
address1 = "C:\Users\Desktop\Tests\Comm Review\Item #" &
cell.Text
If Not IsEmpty(cell) Then
Worksheets("Sheet1").Hyperlinks.Add Anchor:=cell, Address:=address1, TextToDisplay:=cell.Text
End If
Next cell
The cell value will be something like 1001.T0502 and the actual folder name that I am linking to will be Item #1001.T0502. So in my address1 variable i create the path to the folder.
However, when I do this it creates the path with everything but #1001.T0502 and ends up stopping at "\Item". If I were to drop the number sign(#) though it includes the number and ends up being Item 1001.T0502. For some reason the number sign stops it from making the correct path. What am I missing here? There are already 200 folders with the number sign in the folder name so going back now and taking it out would be too much work.
Any help would be appreciated. Thanks!
1407.T0502. The hyperlink created was:C:\Users\Desktop\Tests\Comm Review\Item#1407.T0502Note that the space was removed, but the number was still there.address1 = """C:\Users\Desktop\Tests\Comm Review\Item #" & cell.Text & """"