Hi all,
I think, I am missing something but what?
Regards,
Nikenis
I think, I am missing something but what?
Regards,
Nikenis
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.ScreenUpdating = False
If Intersect(Target, Range("F3:J3")) Is Nothing Then Exit Sub
Dim wsLog As Worksheet
Dim wsInput As Worksheet
Dim NewId As String
Dim filterDate As Date
Dim lastRow As Integer
Set wsLog = Worksheets("Log")
Set wsInput = Worksheets("Input")
With wsInput
filterDate = CDate(.Range("N3").Value)
NewId = .Range("F3").Value
On Error Resume Next
End With
With wsLog
.ListObjects("Table1").Range.AutoFilter Field:=3, Criteria1:=NewId
.ListObjects("Table1").Range.AutoFilter Field:=5, Criteria1:=Array(0, filterDate)
lastRow = .Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).Row
' This copy the value only and I also need the format
.UsedRange.Offset(1, 5).SpecialCells(xlCellTypeVisible).Copy Destination:=Worksheets("Input").Range("D12")
End With
Application.ScreenUpdating = True
End Sub