I am trying to copy every 1st column (1:20000) on every tab I have about 150 tabs and then i want to paste it onto the "upload" tab. Any ideas?
I am trying to copy every 1st column (1:20000) on every tab I have about 150 tabs and then i want to paste it onto the "upload" tab. Any ideas?
Last edited by aehartle; 06-15-2010 at 09:51 AM.
something like this?
![]()
Sub CopyFirstColumns() Dim strAddress As String Dim shtData As Worksheet Dim shtUpload As Worksheet Dim lngCol As Long strAddress = "A1:A100" Set shtUpload = Worksheets("Upload") For Each shtData In Worksheets If shtData.Name <> shtUpload.Name Then lngCol = lngCol + 1 shtData.Range(strAddress).Copy shtUpload.Cells(1, lngCol) End If Next End Sub
Kind of... I noticed in your code it puts the first column in the corresponding next column on the upload tab.
Is it possible to put all first column in one colum...meaning tab 1 has data from A1:A20 and Tab 2 has data from A1:A24. So on the upload tab i should have data from A1:A44. Does that explain it?
Thank you in advance
Any ideas?
![]()
Sub CopyFirstColumns() Dim strAddress As String Dim shtData As Worksheet Dim shtUpload As Worksheet Dim lngCol As Long Dim lngRow As Long strAddress = "A1:A100" Set shtUpload = Worksheets("Upload") lngRow = 1 For Each shtData In Worksheets If shtData.Name <> shtUpload.Name Then shtData.Range(strAddress).Copy shtUpload.Cells(lngRow, 1) lngRow = shtUpload.Cells(shtUpload.Rows.Count, 1).End(xlUp).Row + 1 End If Next End Sub
Awesome thanks!!!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks