+ Reply to Thread
Results 1 to 5 of 5

Need macro for all open workbooks 1st columnc copy

Hybrid View

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

    Re: Need macro for all open workbooks 1st columnc copy

    I was giving me a syntax error

    Sub LoopThroughSheets()
    Dim wbBook As Workbook, rCopy As Range, rPaste As Range

    With Worksheets("Budget")
    For Each wbBook In Workbooks
    If wbBook.Name <> ThisWorkbook.Name Then
    Set rPaste = .Range&(A65536").End(xlUp).Offset(1, 0)
    Set rCopy = wbBook.Range(Range("A1"), Range("A1").End(xlDown))
    rCopy.Copy Destination:=rPaste
    End If
    Next
    End With


    If i can get it to open a new workbook and paste it into sheet 1 that would be great...

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

    Re: Need macro for all open workbooks 1st columnc copy

    If you're posting code, please wrap it in code tags as described here.

    Typo, sorry

    Please replace with this

    Set rPaste = .Range("A65536").End(xlUp).Offset(1, 0)
    Paste this code into an empty workbook and run it.
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

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

    Re: Need macro for all open workbooks 1st columnc copy

    Sorry
    <script type="text/javascript">
    <!--
        alert("Sub CopyFirstColumns()
        Dim strAddress As String
        Dim shtData As Worksheet
        Dim shtUpload As Worksheet
        Dim lngCol As Long
        Dim lngRow As Long
        
        strAddress = "A1:A500"
        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);
    //-->
    </script>
    Last edited by shg; 08-25-2010 at 01:26 PM.

+ 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