Forum Discussion

Steph_V's avatar
Steph_V
Copper Contributor
Aug 30, 2022
Solved

Need Help Please!!

Good morning,   I have been trying to figure this out for several hours over the past 2 day and I am not too sure if what I need done, can be done.  I have a very large Excel workbook w/ several t...
  • OliverScheurich's avatar
    Aug 30, 2022

    Steph_V 

    Sub DNO()
    
    Dim i As Long
    Dim k As Long
    Dim l As Long
    
    l = Range("A" & Rows.Count).End(xlUp).Row
    k = 2
    Worksheets("DNO").Range("A2:AX1048576").Clear
    
    For i = 2 To l
    
    Select Case Cells(i, 51).Value
    
    Case Is = "DNO"
    
    Range(Cells(i, 1), Cells(i, 50)).Copy Destination:=Worksheets("DNO").Cells(k, 1)
    k = k + 1
    
    End Select
    
    Next i
    
    End Sub

    Maybe with this code. In the attached file you can click the button in cell BA2 to run the code. In column AY you can enter "DNO" to copy the row to the designated sheet "DNO". I've entered random numbers in columns A to AX for this example.