I am trying to use a macro that will look up "RequestNumber" from Col A, copy all information on that Row (B:F), and paste it into a new sheet. The code used to use this same exact concept with Date (instead of RequestNumber). :
Here is what I have so far to use on my book. I am a beginner so please bear with me. Any help is greatly appreciated. I will be online for quick replys.
Sub CopyDateRows()
Dim myDate As String
Dim lr As Long
myDate = InputBox("Enter Date")
If IsDate(myDate) Then
Application.ScreenUpdating = False
ActiveSheet.Copy After:=ActiveSheet
With ActiveSheet
lr = .Range("A" & .Rows.Count).End(xlUp).Row
With .Range("A1:A" & lr)
.AutoFilter Field:=1, Criteria1:= _
"<>" & CLng(DateValue(myDate))
.Offset(1).EntireRow.Delete
.AutoFilter
End With
End With
Application.ScreenUpdating = True
Else
MsgBox "No valid date entered"
End If
End Sub
Here is what I have so far to use on my book. I am a beginner so please bear with me. Any help is greatly appreciated. I will be online for quick replys.
Sub CopyNumberRows()
Dim myRequestNumber As String
Dim lr As Long
myRequestNumber = InputBox("Enter Request Number")
If IsRequestNumber(myRequestNumber) Then
Application.ScreenUpdating = False
ActiveSheet.Copy After:=ActiveSheet
With ActiveSheet
lr = .Range("A" & .Rows.Count).End(xlUp).Row
With .Range("A1:A" & lr)
.AutoFilter Field:=1, Criteria1:= _
"<>" & CLng(DateValue(myRequestNumber))
.Offset(1).EntireRow.Delete
.AutoFilter
End With
End With
Application.ScreenUpdating = True
Else
MsgBox "No valid request number entered"
End If
End Sub