Results 1 to 1 of 1

Select case & copy to a different file

Threaded View

  1. #1
    Forum Contributor
    Join Date
    12-19-2006
    Posts
    113

    Select case & copy to a different file

    Hi everyone,

    I need some help with this problem:
    I need copy the cells in column D and E, if in the column B have and X or x, from one sheet to another, starting in the cell E7.

    I create this code but… well, I give up.
    Sub Exp()
    Dim LPr As Integer
    Dim LCp As Integer
        
        On Error GoTo Err_Execute
        
        Sheets("Desp").Activate
    LPr = 3
    LCp = 3
        While Len(Range("E" & LPr).Value) <> ""
            If Range("B" & LPr).Value = "X" _
             Or Range("B" & LPr).Value = "x" Then
                Range("B" & LPr).Offset(0, 2).Copy _
                  Destination:=Sheets("Tabl").Range("E7").End(xlDown).Offset(0, 1)
    '            Range("B" & LPr).Offset(0, 3).Copy _
                  Destination:=Sheets("Tabl").Range("F7").End(xlDown).Offset(0, 1)
                LCp = LCp + 1
        ElseIf Range("B" & LPr).Value = "" Then
            LCp = LCp + 1
        End If
         LPr = LPr + 1
        Wend
        Application.CutCopyMode = False
    
    Err_Execute:
        Exit Sub
    End Sub
    Any help would be appreciated.

    Thanks in advance.
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1