I have a 2 worksheet 1 is for data base with 3 command buttons, 1 sheet for barcode scanner data transferring to excel with date and time stamp are included.
Could someone could help me to split or left and find functions to remove the date and time stamps on A2 and B2 Column when I click my consolidated button.
Here is the code in consolidated button.
I attached the Picture for much
Could someone could help me to split or left and find functions to remove the date and time stamps on A2 and B2 Column when I click my consolidated button.
Here is the code in consolidated button.
VBA Code:
Sub Sample()
Dim ws As Worksheet
Dim wsCon As Worksheet
Dim lr As Long: lr = 2
Dim wsLR As Long
'~~> This is your Consolidated worksheet
Set wsCon = ThisWorkbook.Sheets("Consolidated")
wsCon.AutoFilterMode = False
'~~> Clear the contents for input
wsCon.Range("A2:C" & wsCon.Rows.Count).ClearContents
'~~> Copy the data in to the Consolidated worksheet from other sheets
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> wsCon.Name Then
wsLR = ws.Range("A" & ws.Rows.Count).End(xlUp).Row
ws.Range("A2:C" & wsLR).Copy wsCon.Range("A" & lr)
lr = wsCon.Range("A" & wsCon.Rows.Count).End(xlUp).Row + 1
End If
Next ws
With wsCon
'~~> Remove duplicates
.Range("A1:C" & lr).RemoveDuplicates Columns:=Array(1, 2, 3), Header:=xlYes
'~~> Apply filter in row 1
.Range("A1:C1").AutoFilter
End With
End Sub
I attached the Picture for much
Last edited by a moderator: