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:
Any help would great!!!
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!!!