Avatar of DiCanio13

asked on 

How do i change between excel worksheets in vbscript


Im looking to change between different worksheets in excel using vbscript. At the moment im able to open up one worksheet and make changes to that one sheet - sheet_1, but when i try to set the worksheet to sheet_2 nothing seems to happen, it remains on sheet_1 Does anyone know if im missing some code?
Set objXL = CreateObject("EXCEL.APPLICATION")
Set objWB = objXL.Workbooks.Open ("Input_1.xls")
Set objWS = objWB.Worksheets("sheet_1")
	   objXL.Visible = True
Set objWS = objWB.Worksheets("sheet_2")

Open in new window

ProgrammingMicrosoft ExcelVB Script

Avatar of undefined
Last Comment

8/22/2022 - Mon