-
Whilst either opening a new or existing excel sheet to add in data, it always defaults to sheet 4 (1 sheet after the amount of sheets in the xls.), ie when I create a new excel spreadsheet there are by default 3 sheets, so when I add a sheet and enter data it is on sheet 4, anyone know how I can refer to a particular sheet on an excel spreadsheet in code (I want nothing to do with Macros thanks).
-
No worries.
Code:
Dim xlAPP As New Excel.Application
Dim xlWB As Excel.Workbook
Dim xlWS As Excel.Worksheet
'open a workbook
Set xlWB = xlAPP.Workbooks.Open("test.xls")
'set the worksheet to the first one.
Set xlWS = xlWB.Sheets(1)
-
That did the trick nicely. Thank you.