Announcement

Collapse
No announcement yet.

Copy data to actual File (Macro)º

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Copy data to actual File (Macro)º



    Hello there, I been seen all topics related to this problem and I thought I had found the solution, and is not right.
    As you can see I'm a beginner and I only do small programs when I need to do it several times.
    Basically I do not know how to use the Copy code...
    Somebody have a suggestion?

    HTML Code:
    Sub CopyOutput()
       
        Dim wb1 As Workbook
        Dim wb2 As Workbook
        Dim wbs As Worksheet
        
        Dim Ret1, Ret2 As Variant
        
        
        Set wb1 = ActiveWorkbook
        
        
        '~~> Get the File
        Ret1 = Application.GetOpenFilename("Excel Files (*.xls*), *.xls*", _
        , "Please select file")
        If Ret1 = False Then Exit Sub
     
        Set wb2 = Workbooks.Open(Ret1)
        
        
     
        Set wb2 = Workbooks.Open(Ret1)
        Ret1.Sheets(1).Copy After:=wb1.Sheets(Sheets.Count)
           
        
        wb2.Close SaveChanges:=False
        
    End Sub

  • #2
    Could you please explain in words what you are trying to? Be very detailed referring to specific workbooks and sheets.
    You can say "THANK YOU" for help received by clicking "Like" in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

    Comment


    • #3
      Hello,

      You could testing the following code ...

      Code:
      Sub CopyOutput()
         
          Dim wb1 As Workbook
          Dim wb2 As Workbook
          Dim wbs As Worksheet
          
          Dim Ret1, Ret2 As Variant
          
          Set wb1 = ActiveWorkbook
          
          '~~> Get the File
          Ret1 = Application.GetOpenFilename("Excel Files (*.xls*), *.xls*", _
          , "Please select file")
          If Ret1 = False Then Exit Sub
       
          Set wb2 = Workbooks.Open(Ret1)
          wb2.Sheets(1).Copy After:=wb1.Sheets(wb1.Sheets.Count)
          wb2.Close SaveChanges:=False
          
      End Sub
      Hope this will help
      If you feel like saying "Thank You" for the help received ...You can click on the "Like" icon ...just underneath ... ... in the bottom right corner ...

      Comment


      • #4
        Thanks Carim and Mumps.
        It worked.

        Comment


        • #5


          Glad you could fix your problem ...

          Thanks for your Thanks ... AND for the Like ...
          If you feel like saying "Thank You" for the help received ...You can click on the "Like" icon ...just underneath ... ... in the bottom right corner ...

          Comment

          Working...
          X