Hi All
I need assistance with the following code I have put together from pieces found. I have attached my file. I would want the code to find the specific rows with the date value and only print those rows. Please help have been trying to figure it out for hours.
Sub Print_Date()
Dim rng1 As Range
Dim dateStr As String
Dim dateToFind As Date
Dim foundDate As Range
'Get date as string value
dateStr = InputBox("Enter the date to be found")
'Convert string value to date format
dateToFind = DateValue(dateStr)
'Edit Sheet1 to your worksheet name
Set rng1 = Sheets("Payment transactional history").Range(Cells(1, 9), _
Cells(Rows.Count, 9).End(xlUp))
Set foundDate = rng1.Find(What:=dateToFind, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
If Not foundDate Is Nothing Then
Application.Goto rng1, True
ActiveSheet.PageSetup.PrintArea = Range("b:j").End(xlUp)
Selection.AutoFilter Field:=1, Criteria1:=dateToFind
With ActiveSheet
.PrintPreview
End With
Else
MsgBox dateStr & " not found"
End If
End Sub
Bookmarks