Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In workbook, I have six sheets. Sheets 1, 2 & 3 have data in column A with varied number of rows.
The code here copies each of those columns to sheet 4, Column A. BUT does it twice. Sheet data 1, 2, 3 listed in sheet 4 followed by an identical list right below the first. Once I get the double copy solved, I intend to use an array with the elements as the sheets I want to copy from. There is a sheet 5 & 6 but they are blank now. Still I would prefer to avoid even looking at them unless they were included in the array. Thanks, Howard Option Explicit Sub ThreeColumnsToOne() Dim lastRow As Long, lastRowDest As Long Dim ws As Worksheet Application.ScreenUpdating = False lastRowDest = 1 For Each ws In ThisWorkbook.Sheets lastRow = ws.Range("A" & Rows.Count).End(xlUp).Row ws.Range("A1:A" & lastRow).Copy Destination:=Sheets("Sheet4").Range("A" & lastRowDest)(1) lastRowDest = Sheets("Sheet4").Range("A" & Rows.Count).End(xlUp).Row + 1 Next Application.ScreenUpdating = True MsgBox "Done!" End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Code copies between key word is in reverse order | Excel Programming | |||
Code For Copy Copies Twice | Excel Programming | |||
Number of copies to print keep defaulting to 12 copies why? | Excel Worksheet Functions | |||
Code that searches a column, then copies and pastes any matches intoa new Spreadsheet | Excel Programming | |||
Trying to eliminate multiple copies of the SAME code within a UserForm | Excel Programming |