I am having some difficulties with a Macro I am currently working on. Specifically, I have having problems using 2 Find functions. Separetly I am able to get them to work properly but it seems I have issues having work together.
In general, my intentions with this Macro is to copy information listed in spreadsheet A to spreadsheet B beased upon the the date the user enters. Both spreadsheet A and B have date references.
Here is the code I have thus far:
Code:
Thank you in advance for your help!
In general, my intentions with this Macro is to copy information listed in spreadsheet A to spreadsheet B beased upon the the date the user enters. Both spreadsheet A and B have date references.
Here is the code I have thus far:
Code:
Code:
Sub Find_First()
Dim wb As String
Dim FindString As String
Dim Rng As Range
wb = Range("w1").Value
FindString = InputBox("Enter Date in mm/dd/yy format")
If Trim(FindString) <> "" Then
With Sheets("Sheet1").Range("A:A")
Set Rng = .Find(what:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
ActiveSheet.Range(Cells(Application.ActiveCell.Row, 2), Cells(Application.ActiveCell.Row, 23)).Copy
Workbooks.Open("FileB.xls").Activate
Sheets(wb).Select
If Not Rng Is Nothing Then
Application.Goto Rng, True
Else
MsgBox "Nothing found"
End If
End With
End If
If Trim(FindString) <> "" Then
With Sheets(wb).Range("B3:B367")
Set Rng = .Find(what:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
Cells(Application.ActiveCell.Row, 11).Select
ActiveSheet.Paste
Application.CutCopyMode = False
If Not Rng Is Nothing Then
Application.Goto Rng, True
Else
MsgBox "Nothing found"
End If
End With
End If
End Sub
Thank you in advance for your help!