Consulting

Results 1 to 3 of 3

Thread: Solved: Copy a range from the fourth sheet on

  1. #1

    Solved: Copy a range from the fourth sheet on

    In a tracking workbook, I have anywhere from 5 to 60+ sheets, job time depending.
    At the end of the job I want to summarize the entries from cells C10 and D10 of
    all sheets except the first three sheets.
    Cell C10 has a text string and cell D10 is an amount relating to Cell C10.

    I found this but I need to change it so it starts copying from sheet4.

    Sub Combine()
    Dim destSH As Worksheet, sh As Worksheet
    Dim rw As Long
     
    Application.ScreenUpdating = False
     
    Set destSH = Worksheets.Add(After:=Worksheets(Worksheets.Count))
    destSH.Name = "Summary"
     
    rw = 10
     
    For Each sh In Worksheets
    If sh.Name <> destSH.Name Then
    sh.Range("B3:C3").Copy
                           With destSH.Cells(rw, 1)
             .PasteSpecial Paste:=xlPasteValues
    End With
     
    rw = rw + 1
     
    End If
     
    Next sh
     
    Application.ScreenUpdating = True
     
    End Sub
    Could someone please assist me with this?

    Thanks and Regards
    John

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    For shNum = 4 To Worksheets.Count

    Set sh = Worksheets(shNum)
    If sh.Name <> destSH.Name Then
    sh.Range("B3:C3").Copy
    With destSH.Cells(rw, 1)
    .PasteSpecial Paste:=xlPasteValues
    End With

    rw = rw + 1
    End If
    Next shNum
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Hi Bob.

    Works great.

    Thank you very much.

    John

Posting Permissions

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