dj44
09-01-2018, 03:44 AM
Good staurday folks,
A quick one I hope
I just wanted to output the result in Column K From Row 5
Sub Combine_Cols()
Dim i As Long, j As Long, k As Long, l As Long, m As Long, n As Long
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("test")
For i = 5 To ws.Cells(Rows.Count, 5).End(xlUp).Row
For j = 5 To ws.Cells(Rows.Count, 6).End(xlUp).Row
If ws.Cells(Rows.Count, 11).End(xlUp).Row = 10000 Then
MsgBox "10000 rows reached"
Exit Sub
Else
ws.Cells(Rows.Count, 11).End(xlUp)(2) = ws.Cells(i, 5) & " " & ws.Cells(j, 6) & " "
End If
Next j
Next i
End Sub
I tried to fiddle about but im not sure why I cant get it to start from row 5 in Column K
Thank you for any tips
A quick one I hope
I just wanted to output the result in Column K From Row 5
Sub Combine_Cols()
Dim i As Long, j As Long, k As Long, l As Long, m As Long, n As Long
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("test")
For i = 5 To ws.Cells(Rows.Count, 5).End(xlUp).Row
For j = 5 To ws.Cells(Rows.Count, 6).End(xlUp).Row
If ws.Cells(Rows.Count, 11).End(xlUp).Row = 10000 Then
MsgBox "10000 rows reached"
Exit Sub
Else
ws.Cells(Rows.Count, 11).End(xlUp)(2) = ws.Cells(i, 5) & " " & ws.Cells(j, 6) & " "
End If
Next j
Next i
End Sub
I tried to fiddle about but im not sure why I cant get it to start from row 5 in Column K
Thank you for any tips