Hello,
This is my very first post so pardon any faux pas, plus I am only a beginner at teaching myself VBA so please excuse any knowledge gaps. I've been trying to Frankenstein codes from too many forums and just can't get what I want to do done.
My conundrum (and I will try to be as specific and detailed as possible; hopefully this isn't too specific an issue to get sorted on the forum)-
I download numerous worksheets and insert each into a summary workbook one at a time using unique numbers in a list of document tags. (i.e I search doc #0274055504 on our system and download the report). Each worksheet/report has a value in cell D11 which is it's unique identifier/document number/tag.
1. I take the value from D11 (i.e 0274055504) and rename the tab as this tag:
(I have this section working but am including it in case any of the elements will follow into other sections)
Dim xWs As Worksheet
Dim xRngAddress As String
Dim xName As String
Range("D11").Select
xRngAddress = Application.ActiveCell.Address
For Each xWs In Application.ActiveWorkbook.Sheets
xName = xWs.Range(xRngAddress).Value
If xName <> "" Then
xWs.Name = xName
End If
Next
2. I now want to find the cell containing this tag (specifically the value from D11 in my download - i.e. 0274055504) my summary doc and make that cell a hyperlink to the tab in the workbook (which is named 0274055504). So that clicking the cell takes you to the tab of that name.
This is what I have and want to make it dynamic depending on the value in cell D11, basically:
Range("D11").Select
'in this example, as you can hopefully see, the value in D11 is 0274055504
Selection.Copy
Sheets("working").Select
Cells.Find(What:="0274055504", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
"'0274055504'!A1", TextToDisplay:="0274055504"
I want to replace all the numerical text '0274055504' with a reference to D11. Any and all suggestions appreciated, maybe there is a much simpler way that is completely different from the way I'm working it now...
Thanks so much.
PS I hope I did this right...
This is my very first post so pardon any faux pas, plus I am only a beginner at teaching myself VBA so please excuse any knowledge gaps. I've been trying to Frankenstein codes from too many forums and just can't get what I want to do done.
My conundrum (and I will try to be as specific and detailed as possible; hopefully this isn't too specific an issue to get sorted on the forum)-
I download numerous worksheets and insert each into a summary workbook one at a time using unique numbers in a list of document tags. (i.e I search doc #0274055504 on our system and download the report). Each worksheet/report has a value in cell D11 which is it's unique identifier/document number/tag.
1. I take the value from D11 (i.e 0274055504) and rename the tab as this tag:
(I have this section working but am including it in case any of the elements will follow into other sections)
Dim xWs As Worksheet
Dim xRngAddress As String
Dim xName As String
Range("D11").Select
xRngAddress = Application.ActiveCell.Address
For Each xWs In Application.ActiveWorkbook.Sheets
xName = xWs.Range(xRngAddress).Value
If xName <> "" Then
xWs.Name = xName
End If
Next
2. I now want to find the cell containing this tag (specifically the value from D11 in my download - i.e. 0274055504) my summary doc and make that cell a hyperlink to the tab in the workbook (which is named 0274055504). So that clicking the cell takes you to the tab of that name.
This is what I have and want to make it dynamic depending on the value in cell D11, basically:
Range("D11").Select
'in this example, as you can hopefully see, the value in D11 is 0274055504
Selection.Copy
Sheets("working").Select
Cells.Find(What:="0274055504", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
"'0274055504'!A1", TextToDisplay:="0274055504"
I want to replace all the numerical text '0274055504' with a reference to D11. Any and all suggestions appreciated, maybe there is a much simpler way that is completely different from the way I'm working it now...
Thanks so much.
PS I hope I did this right...