Hello All,
I am trying to sort out a code which auto filters data from various sheets and copies to a new sheet.
I have a problem in last row once the data is filtered. The last row brings out the actual last row value instead of visible cells ( For Example after auto filtering there are only 4 rows , but the last rows Excel serial number is 1109 , so last row is reflecting as 1109). Any help would be greatly appreciated. I just need to copy the filtered data. Thank you for your time.
I have attached the code below. I am unable to add a sample sheet through XL2BB add in as the data is sensitive. If it all you require a sample let me know, I will post sample values. Thanks once again
I am trying to sort out a code which auto filters data from various sheets and copies to a new sheet.
I have a problem in last row once the data is filtered. The last row brings out the actual last row value instead of visible cells ( For Example after auto filtering there are only 4 rows , but the last rows Excel serial number is 1109 , so last row is reflecting as 1109). Any help would be greatly appreciated. I just need to copy the filtered data. Thank you for your time.
I have attached the code below. I am unable to add a sample sheet through XL2BB add in as the data is sensitive. If it all you require a sample let me know, I will post sample values. Thanks once again
VBA Code:
Sub ledger()
Dim ws As Worksheet, wsd As Worksheet, lr As Long
Set wsd = Sheets("Cust.Ledger")
For Each ws In Worksheets
Select Case ws.name
Case "Rate Update", "Receivables", "Cust.Ledger", "Names"
Case Else
ws.AutoFilterMode = False
ws.Range("A1:K1").AutoFilter Field:=3, Criteria1:=wsd.Range("K3").Value
lr = ws.Range("A" & Rows.Count).End(xlUp).Row
If lr > 1 Then
ws.Range("A2:K" & lr).Copy wsd.Range("A2")
Else
End If
ws.AutoFilterMode = False
End Select
Next
End Sub