Accessing Excel sheet without mentioning its name in VBA program
问题 How can I refer Excel sheet using VBA which has only one sheet without mentioning the sheet name in my program? Actually the sheet name might change next time with new data and it is creating a problem in my automation process. 回答1: If your macro is running on the same file, you can simply refer to it using the global ActiveWorksheet object. If you are loading it from somewhere else, you will be probably doing something like this: Dim objWorkbook as Workbook Dim objWorksheet as Worksheet Set