
10-18-2005, 01:42 PM
|
 |
Freshman
|
|
Join Date: Oct 2005
Posts: 29
|
|
Hey Garry
See if this is what you were looking for:
Code:
Option Explicit
Sub CopyPaste()
Application.ScreenUpdating = False
Dim iLastRow As Long
Dim i As Long
Dim j As Long
Dim WS As Worksheet
Set WS = ThisWorkbook.Worksheets.Add
WS.Name = "New Data Sheet"
j = 1
For i = 10 To 100 Step 10
With Workbooks("Book2.xls").Sheets("Sheet1").Activate
iLastRow = Cells(Rows.Count, i).End(xlUp).Row
Range(Cells(1, i), Cells(iLastRow, i)).Copy
End With
With Workbooks("Book1.xls").Sheets(WS.Name).Activate
Sheets(WS.Name).Range(Cells(1, j), Cells(iLastRow, j)).PasteSpecial xlAll
End With
j = j + 1
Next
Application.ScreenUpdating = True
End Sub
Just go into the VBE by pressing ALT+F11, right-click on VBAProject(Book1) (the book what will have the new sheet) and select Insert Module and paste this in there.
Be sure to change "Book1.xls" and "Book2.xls" accordingly (Book2 has the data to be copied, BTW) and make sure they're in the same folder when you do this.
|
|