Hi team,
I've gotten into the habit of creating code like so, which requires the .select behaviour. Which is all well and good but I now want to not have to make tabs visible due to the limitations of my code. How would you suggest I get the same output, without the use of .select which requires a visible and active tab?
I know my code aint pretty but it works... Could be a lot better though.
To add context, I have a share point list which has a name, i.e. "review document", then the next column is the location of that word document template. I have hidden sheets which pull down the lists, and when the user wants to create their document, it looks for the type of document they're trying to create, looks up the cell on the hidden sheet, moves over one column and that is the file location.
Thanks,
Ben
edit: poor grammar
I've gotten into the habit of creating code like so, which requires the .select behaviour. Which is all well and good but I now want to not have to make tabs visible due to the limitations of my code. How would you suggest I get the same output, without the use of .select which requires a visible and active tab?
I know my code aint pretty but it works... Could be a lot better though.
To add context, I have a share point list which has a name, i.e. "review document", then the next column is the location of that word document template. I have hidden sheets which pull down the lists, and when the user wants to create their document, it looks for the type of document they're trying to create, looks up the cell on the hidden sheet, moves over one column and that is the file location.
Thanks,
Ben
Code:
Dim FileLocation As String
On Error Resume Next
ThisWorkbook.Sheets("File Paths").Visible = True
ThisWorkbook.Sheets("File Paths").Select
lastrow = ThisWorkbook.Sheets("File Paths").range("A" & Rows.Count).End(xlUp).row
Set TemplateRange = ThisWorkbook.Sheets("File Paths").range("B2:B" & lastrow)
For Each C In TemplateRange
If C.Value = "Review Document" Then
C.Select
ActiveCell.Offset(0, 1).Select
FileLocation = ActiveCell.Value
Exit For
End If
Next C
ThisWorkbook.Sheets("File Paths").Visible = False
edit: poor grammar
Last edited: