I am new to VBA and got that problem which I don't know how to fix.
I have a workbook with some sheets and I create a new workbook for each sheet in that first one with the name of the sheets. That works...
Now, I declare a variable of type string which defines the path to one of these new workbooks.
After defining that string I use that in the open function and when i change something in that workbook i opened, it also changes it in the worksheet where i get the name from(e.g. the name of the worksheet, like below)
Public Sub ProcessWorksheet(ByVal Worksheet As Excel.Worksheet)
Dim fileName As String
Dim currProFile as Workbook
Dim currProSheet as Worksheet
fileName ="some path" & "\" & worksheet.name & ".xlsx"
Set currProFile = Workbooks.Open(fileName)
Set currProSheet = currProFile.ActiveSheet
currProSheet.name = "DATA"
End Sub
So I think there is a reference to that worksheet i just use for the name cause of that worksheet.name.
My question is: How can I get the name without a reference to the worksheet.
I hope it is all cleal and thanks for help!