how do I write to inactive sheets in VB6? instead of activating, i'd like to keep one sheet on top, while writing data to sheets at random.
or should I be going this with WorkBook object?Code:Set oExcel = CreateObject("Excel.Application") For N = 1 To num SheetName = "Sheet" + CStr(N) 'oExcel.Sheets(SheetName).Select oExcel.Sheets(SheetName).Name = CStr("Layer " + CStr(N)) Set therange = oExcel.Range(oExcel.sheets(SheetName).Cells(1, 1), oExcel.sheets(SheetName).Cells(12, 6)) 'this gives me runtime error 9 - subscript out of range therange.Value = thearray oExcel.Sheets(SheetName).Columns("A:A").EntireColumn.AutoFit Next N
thanks for helping me!




Reply With Quote