Results 1 to 6 of 6

Thread: [RESOLVED] Something weird is happening in excel (VBA)

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2012
    Posts
    27

    Resolved [RESOLVED] Something weird is happening in excel (VBA)

    Hi guys,

    Got this code below where ws1/2/3 etc makes reference to my worksheet. All stuff is defined.

    Code:
        Dim i As Long
            
        Dim RwCount1 As Long
        
        RwCount1 = ws5.Range("F" & Rows.Count).End(xlUp).Row
        
        For i = 2 To RwCount1
        
        If ws5.Range("CG" & i).Value = "Unknown" Or "0" Then
        ws5.Activate
        ws5.Range("E" & i).Select
        Selection.Copy
        ws6.Activate
        Range("J" & Rows.Count).End(xlUp).Offset(1, 0).Select
        ActiveSheet.Paste
        
        End If
        
        Next i
        
        Application.ScreenUpdating = True
        
        End Sub
    This macro looks through column CG and determines which have an "unknown" or "0" value assigned as the result of a formula. It then pastes the corresponding value of column E into a new sheet.

    Now its doing this fine, but for some reason it is not taking in duplicate values, which is fantastic as it has saved me from writing the code to get rid of duplicates; but does anyone know why it is acting like this?


    Thanks
    Last edited by Siddharth Rout; Jul 24th, 2012 at 10:02 AM. Reason: Code Tags Added

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width