Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.excel.programming > #108202

Re: For Each sheet in WkBook problem

From GS <gs@v.invalid>
Newsgroups microsoft.public.excel.programming
Subject Re: For Each sheet in WkBook problem
Date 2015-11-26 17:37 -0500
Organization A noiseless patient Spider
Message-ID <n381ec$d8f$1@dont-email.me> (permalink)
References <7bba9374-c6a1-4952-ae63-826d1b19b773@googlegroups.com>

Show all headers | View raw


Hi Howard,
Any time I have to consolidate data from multiple sheets to a 'summary' 
sheet I use the following logic:

Dim wks As Worksheet, vData, lNextRow&

With Sheets("Summary")
  'Get the next row position on the summary sheet
  lNextRow = .Cells(1, .Rows.Count).End(xlUp).Row + 1

  For Each wks In ThisWorkbook.Sheets
    'Load the data range on each consolidation sheet into an array.
    If (wks.Name <> "Summary") And (wks.Name <> "Begin blad") Then
      vData = wks.Range("A2", wks.Range("D2").End(xlDown))

      'Assign the array to the next row position
      .Cells(lNextRow, 1).Resize(Ubound(vData), _
                                 Ubound(vdata), 2) = vData

      'Increment the next row position
      lNextRow = lNextRow + Ubound(vData)
    End If
  Next 'wks
End With 'Sheets("Summary")

-- 
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
  comp.lang.basic.visual.misc
  microsoft.public.vb.general.discussion

Back to microsoft.public.excel.programming | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

For Each sheet in WkBook problem "L. Howard" <lhkittle@comcast.net> - 2015-11-26 13:40 -0800
  Re: For Each sheet in WkBook problem GS <gs@v.invalid> - 2015-11-26 17:37 -0500
    Re: For Each sheet in WkBook problem "L. Howard" <lhkittle@comcast.net> - 2015-11-26 16:47 -0800
      Re: For Each sheet in WkBook problem GS <gs@v.invalid> - 2015-11-26 20:02 -0500
        Re: For Each sheet in WkBook problem "L. Howard" <lhkittle@comcast.net> - 2015-11-26 17:50 -0800
          Re: For Each sheet in WkBook problem GS <gs@v.invalid> - 2015-11-26 21:10 -0500
            Re: For Each sheet in WkBook problem "L. Howard" <lhkittle@comcast.net> - 2015-11-26 18:17 -0800
              Re: For Each sheet in WkBook problem GS <gs@v.invalid> - 2015-11-26 21:28 -0500
                Re: For Each sheet in WkBook problem "L. Howard" <lhkittle@comcast.net> - 2015-11-26 18:33 -0800
                Re: For Each sheet in WkBook problem GS <gs@v.invalid> - 2015-11-26 23:03 -0500
                Re: For Each sheet in WkBook problem "L. Howard" <lhkittle@comcast.net> - 2015-11-26 20:55 -0800
                Re: For Each sheet in WkBook problem GS <gs@v.invalid> - 2015-11-27 01:45 -0500
                Re: For Each sheet in WkBook problem Claus Busch <claus_busch@t-online.de> - 2015-11-27 07:51 +0100
                Re: For Each sheet in WkBook problem GS <gs@v.invalid> - 2015-11-27 02:04 -0500
                Re: For Each sheet in WkBook problem "L. Howard" <lhkittle@comcast.net> - 2015-11-27 00:14 -0800
                Re: For Each sheet in WkBook problem Claus Busch <claus_busch@t-online.de> - 2015-11-27 09:22 +0100
                Re: For Each sheet in WkBook problem GS <gs@v.invalid> - 2015-11-27 03:26 -0500
                Re: For Each sheet in WkBook problem Claus Busch <claus_busch@t-online.de> - 2015-11-27 09:30 +0100
                Re: For Each sheet in WkBook problem GS <gs@v.invalid> - 2015-11-27 03:40 -0500
                Re: For Each sheet in WkBook problem GS <gs@v.invalid> - 2015-11-27 03:41 -0500
                Re: For Each sheet in WkBook problem Claus Busch <claus_busch@t-online.de> - 2015-11-27 09:46 +0100
                Re: For Each sheet in WkBook problem "L. Howard" <lhkittle@comcast.net> - 2015-11-27 01:10 -0800
                Re: For Each sheet in WkBook problem Claus Busch <claus_busch@t-online.de> - 2015-11-27 10:20 +0100
                Re: For Each sheet in WkBook problem "L. Howard" <lhkittle@comcast.net> - 2015-11-27 01:43 -0800
                Re: For Each sheet in WkBook problem GS <gs@v.invalid> - 2015-11-27 04:49 -0500
                Re: For Each sheet in WkBook problem Claus Busch <claus_busch@t-online.de> - 2015-11-27 10:51 +0100
                Re: For Each sheet in WkBook problem Claus Busch <claus_busch@t-online.de> - 2015-11-27 10:53 +0100
                Re: For Each sheet in WkBook problem GS <gs@v.invalid> - 2015-11-27 04:54 -0500
                Re: For Each sheet in WkBook problem "L. Howard" <lhkittle@comcast.net> - 2015-11-27 02:19 -0800
                Re: For Each sheet in WkBook problem GS <gs@v.invalid> - 2015-11-27 04:22 -0500
                Re: For Each sheet in WkBook problem GS <gs@v.invalid> - 2015-11-27 04:24 -0500
                Re: For Each sheet in WkBook problem "L. Howard" <lhkittle@comcast.net> - 2015-11-27 01:48 -0800
                Re: For Each sheet in WkBook problem GS <gs@v.invalid> - 2015-11-27 04:51 -0500
                Re: For Each sheet in WkBook problem Claus Busch <claus_busch@t-online.de> - 2015-11-27 08:01 +0100
                Re: For Each sheet in WkBook problem GS <gs@v.invalid> - 2015-11-27 02:16 -0500
                Re: For Each sheet in WkBook problem Claus Busch <claus_busch@t-online.de> - 2015-11-27 08:22 +0100
                Re: For Each sheet in WkBook problem GS <gs@v.invalid> - 2015-11-27 03:03 -0500

csiph-web