Results 1 to 3 of 3

Thread: modifying inactive sheets

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2007
    Posts
    234

    modifying inactive sheets

    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.
    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
    or should I be going this with WorkBook object?
    thanks for helping me!
    Last edited by unxzst; Jun 20th, 2008 at 07:52 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width