Forum Discussion
edu1102
Aug 18, 2022Copper Contributor
select text from a file
dear friends I work excel files where the column B is a text this text repeat several columns down question how to select the firsts two names om column b and copy and paste on another file th...
- Aug 18, 2022
Sub selectrows() Dim i As Long Dim j As Long Dim k As Long Dim m As Long Dim n As Long Range("F:I").Clear m = 2 i = Range("A" & Rows.Count).End(xlUp).Row For j = 2 To i n = Application.WorksheetFunction.CountIf(Range(Cells(2, 2), Cells(j, 2)), Cells(j, 2)) If n = 1 Then Range(Cells(j, 1), Cells(j + 1, 4)).Copy Destination:=Cells(m, 6) m = m + 2 Else End If Next j End SubMaybe with these lines of code. In the attached file you can click the button in cell K2 to run the macro.
OliverScheurich
Aug 18, 2022Gold Contributor
Sub selectrows()
Dim i As Long
Dim j As Long
Dim k As Long
Dim m As Long
Dim n As Long
Range("F:I").Clear
m = 2
i = Range("A" & Rows.Count).End(xlUp).Row
For j = 2 To i
n = Application.WorksheetFunction.CountIf(Range(Cells(2, 2), Cells(j, 2)), Cells(j, 2))
If n = 1 Then
Range(Cells(j, 1), Cells(j + 1, 4)).Copy Destination:=Cells(m, 6)
m = m + 2
Else
End If
Next j
End SubMaybe with these lines of code. In the attached file you can click the button in cell K2 to run the macro.
- edu1102Aug 18, 2022Copper Contributor
My Friend thank you for your help
Iwill credit you on this work
If you need anyhthing that i can help you
I will be at your service
best of the best
eduardo