Results 1 to 3 of 3

Thread: Array

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Posts
    15

    Lightbulb

    How do I change the following code to include multiple sheets vs. only one?

    Sub DoLoop()

    Dim i As Integer
    Dim sNCell As String

    Set currentCell = Worksheets("Sheet1").Range("B2")

    i = 1
    Do While Not IsEmpty(currentCell)

    i = i + 1
    sNCell = "N" & i

    Worksheets("Sheet1").Range("N2").Copy _
    Destination:=Worksheets("Sheet1").Range(sNCell)

    Set nextCell = currentCell.Offset(1, 0)

    Set currentCell = nextCell

    Debug.Print currentCell

    Loop

    Any ideas are helpful. Thanks!!!

    Confused

  2. #2
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    I haven't tested this because i am not really sure what or where that code is supposed to be / do, but it may work.

    Code:
    Dim myWS as WorkSheet
    
    For Each myWS in WorkSheets
      '....
      'Code
      '....
    Next
    Iain, thats with an i by the way!

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Posts
    15
    Thanks for the help!!!! Any other suggestions are also welcome.
    Confused

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