-
Count no. of item copied.
Hi guys,
How do I count the number of item copied and prompt it in a message box. Im using the code below to copy the data.
[VBA]
Last_Rw = .Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To Last_Rw
If .Cells(i, "l").Value = "xxx" Then
WS_Pas.Cells(Rw_Ct, 1).Value = .Cells(i, "A").Value
Rw_Ct = Rw_Ct + 1
T_Str = T_Str & "A" & i & ","
End If
Next i
[/VBA]
Thank you
-
I think you mean like this?
[vba]
Dim Count as Long
For i = 2 To Last_Rw
If .Cells(i, "l").Value = "xxx" Then
WS_Pas.Cells(Rw_Ct, 1).Value = .Cells(i, "A").Value
Rw_Ct = Rw_Ct + 1 T_Str = T_Str & "A" & i & ","
End If
Count = Count + 1
Next i
MsgBox Count & Space(2) & "files copied.", vbOKOnly
[/vba]
-
Yes thats exactly what I mean, but I have a problem it also counts duplicated item. Is there any way to rewrite this one so that i can also count the number of duplicated item?
[VBA]
ActiveSheet.Range("$A$1:$X$5000").RemoveDuplicates Columns:=Array(1, 2, 3, 4, 5, 6, 7 _
, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24), Header:=xlYes
[/VBA]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules