+ Reply to Thread
Results 1 to 6 of 6

Copy 1st column in every tab in work book and paste on Final

Hybrid View

  1. #1
    Registered User
    Join Date
    05-12-2010
    Location
    Adrian, MI
    MS-Off Ver
    Excel 2010
    Posts
    76

    Copy 1st column in every tab in work book and paste on Final

    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.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Copy 1st column in every tab in work book and paste on Final

    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
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    05-12-2010
    Location
    Adrian, MI
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: Copy 1st column in every tab in work book and paste on Final

    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

  4. #4
    Registered User
    Join Date
    05-12-2010
    Location
    Adrian, MI
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: Copy 1st column in every tab in work book and paste on Final

    Any ideas?

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Copy 1st column in every tab in work book and paste on Final

    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

  6. #6
    Registered User
    Join Date
    05-12-2010
    Location
    Adrian, MI
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: Copy 1st column in every tab in work book and paste on Final

    Awesome thanks!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1