VBS code cycle thru sheets doesn't work

Glenn Nelson 0 Reputation points

I am trying to cycle thru sheets to perform code. It works on the first sheet, but not the others. The code fails (stops) at the Set rngTarget expression.

For Each sheet In ActiveWorkbook.Worksheets
    If sheet.Index > 1 Then
        Set rngTarget = sheet.Range(Cells(1, 8), Cells(1, arrSize))
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
2,172 questions
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
275 questions
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Viorel 88,316 Reputation points

    Try this:

    Set rngTarget = sheet.Range(sheet.Cells(1, 8), sheet.Cells(1, arrSize))
    1 person found this answer helpful.
    No comments