Macro to copy data from one file to another

tbcoolguy

New Member
Joined
Feb 24, 2011
Messages
2
Good Day all,
I posed a question last week and received no response so I am providing further clarification on my problem.
I am currently attempting to allow a user to copy data specific data from one spreadsheet to another. The user would be promted to enter the date of concern and the macro would then look at File A and copy it over to File B.
Thus far I am having problems with the data remaining in the clip board after File B is opened.
Here is the current code:

Code:
Sub Find_First()
    Dim wb As String
    Dim FindString As String
    Dim Rng1 As Range
    Dim Rng2 As Range
 
    wb = Range("w1").Value
        FindString = InputBox("Enter Date in mm/dd/yy format")
 
Columns("A:A").NumberFormat = "mm/dd/yy;@"
 
If Trim(FindString) <> "" Then
        With Sheets("Sheet1").Range("A:A")
            Set Rng1 = .Find(what:=FindString, _
                            After:=.Cells(.Cells.Count), _
                            LookIn:=xlValues, _
                            LookAt:=xlWhole, _
                            SearchOrder:=xlByRows, _
                            SearchDirection:=xlNext, _
                            MatchCase:=False)
              Sheets(wb).Select
 
         If Not Rng1 Is Nothing Then
                Application.Goto Rng1, True
            Else
                MsgBox "Nothing found"
            End If
        End With
    End If
 
ActiveSheet.Range(Cells(Application.ActiveCell.Row, 2), Cells(Application.ActiveCell.Row, 23)).Copy
 
    Workbooks.Open("C:\Documents and Settings\tmxkb\My Documents\macrotest\FileB.xls").Activate
 
                Sheets(wb).Select
                Range("B3:B367").NumberFormat = "mm/dd/yy;@"
 
 
        If Trim(FindString) <> "" Then
        With Sheets(wb).Range("B3:B367")
            Set Rng2 = .Find(what:=FindString, _
                            After:=.Cells(.Cells.Count), _
                            LookIn:=xlValues, _
                            LookAt:=xlWhole, _
                            SearchOrder:=xlByRows, _
                            SearchDirection:=xlNext, _
                            MatchCase:=False)
                            
 
                  If Not Rng2 Is Nothing Then
                Application.Goto Rng2, True
            Else
                MsgBox "Nothing found"
        End If
        End With
                            ActiveSheet.Paste Destination:=Cells(Rng2.Row, 11)
                            Application.CutCopyMode = False
                           
    End If
End Sub


Any help would great!!!
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,224,586
Messages
6,179,730
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top