C
CompleteNewb
I'm trying to find out how to make a string variable's value the name of the
LAST sheet in an EXTERNAL workbook. In lieu of actually setting a string
variable, I've been using msgbox just to see instantly upon running the sub
whether I've got it or not.
I've tried:
msgbox Workbooks("D:\Big Folder\Little Folder\Last
Folder\WorkbookName.xls").Worksheets(Worksheets.Count).Name
I've tried:
Dim LastSht As String
Dim wkbk As Workbook
Dim wks As Worksheet
set wkbk =
....actually, I forget what all I did with that last starting point, I've
been trying so many things I delete the last 5 permutations when nothing
seems to work, and then start fresh. I think I was trying to declare the
workbook and worksheet objects, then setting the paths, then using the .name
property to set the string variable to the name of the last worksheet.
Anyway, nothing I'm trying has been working. It doesn't seem to work
whether the external workbook is open or not. Can anyone help me figure out
how to get the name of the LAST sheet (the text in the tab of the sheet that
is rightmost in the workbook) of an external workbook (not in same
directory)? Let's assume my current workbook is in D:\Whatever\ and the
external workbook is in D\Somewhere else\Somewhere else again\.
Any help would be greatly appreciated, and thanks for reading.
CompleteNewb
LAST sheet in an EXTERNAL workbook. In lieu of actually setting a string
variable, I've been using msgbox just to see instantly upon running the sub
whether I've got it or not.
I've tried:
msgbox Workbooks("D:\Big Folder\Little Folder\Last
Folder\WorkbookName.xls").Worksheets(Worksheets.Count).Name
I've tried:
Dim LastSht As String
Dim wkbk As Workbook
Dim wks As Worksheet
set wkbk =
....actually, I forget what all I did with that last starting point, I've
been trying so many things I delete the last 5 permutations when nothing
seems to work, and then start fresh. I think I was trying to declare the
workbook and worksheet objects, then setting the paths, then using the .name
property to set the string variable to the name of the last worksheet.
Anyway, nothing I'm trying has been working. It doesn't seem to work
whether the external workbook is open or not. Can anyone help me figure out
how to get the name of the LAST sheet (the text in the tab of the sheet that
is rightmost in the workbook) of an external workbook (not in same
directory)? Let's assume my current workbook is in D:\Whatever\ and the
external workbook is in D\Somewhere else\Somewhere else again\.
Any help would be greatly appreciated, and thanks for reading.
CompleteNewb