Consulting

Results 1 to 3 of 3

Thread: Count no. of item copied.

  1. #1
    VBAX Regular deedii's Avatar
    Joined
    Dec 2011
    Posts
    50
    Location

    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

  2. #2
    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]

  3. #3
    VBAX Regular deedii's Avatar
    Joined
    Dec 2011
    Posts
    50
    Location
    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
  •