Hi there,
Here I come with another question that I can't seem to find answer to anywhere.
I have following code that is responsible for creating hyperlink to a sheet whose name is the same as cell (r, 4) value:
If the sheet name is one word (i.e. 123 or INC or WHATEVER) the code works fine and the hyperlink created works fine.
However if Sheet name is two or more words (i.e. 123 456 or WORLD INC or WHATEVER YOU WISH) the hyperlink is created but does not work (Reference not valid).
I assume it's creating link to sheet named as only one part of the cell.value.
Here's the thing - in VBA excel is using ' to mark the start and end of long names (i.e. '123 456' or 'WORLD INC' or 'WHATEVER YOU WISH') but in my scenario I cannot use explicit names (or Sheet numbers like Sheet1 etc.) because new sheets will be created and code should work for all of them.
So is there any way to achieve what I am aiming for here? Or should I just use "_" in names instead of spaces and forget about any fancy VBA resolution?
Here I come with another question that I can't seem to find answer to anywhere.
I have following code that is responsible for creating hyperlink to a sheet whose name is the same as cell (r, 4) value:
Rich (BB code):
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:=Cells(r, 4).Value & "!A1", ScreenTip:=Cells(r, 4).Value, TextToDisplay:="....."
If the sheet name is one word (i.e. 123 or INC or WHATEVER) the code works fine and the hyperlink created works fine.
However if Sheet name is two or more words (i.e. 123 456 or WORLD INC or WHATEVER YOU WISH) the hyperlink is created but does not work (Reference not valid).
I assume it's creating link to sheet named as only one part of the cell.value.
Here's the thing - in VBA excel is using ' to mark the start and end of long names (i.e. '123 456' or 'WORLD INC' or 'WHATEVER YOU WISH') but in my scenario I cannot use explicit names (or Sheet numbers like Sheet1 etc.) because new sheets will be created and code should work for all of them.
So is there any way to achieve what I am aiming for here? Or should I just use "_" in names instead of spaces and forget about any fancy VBA resolution?