I'm trying to run a macro to concatenate two columns J&D to column K.
Ive looked through past threads and got this far, but some of my cells are blank in column J&D but would still like to combine the data.
What do I need to change to make this happen I'm guessing its something to do with the writing in green but not to sure what to change it to.
Sub CombineCols()
Dim oWS As Worksheet, lLastRow As Long, r As Long
Set oWS = ActiveSheet
lLastRow = oWS.Cells.SpecialCells(xlLastCell).row
For r = 1 To lLastRow
If Len(oWS.Cells(r, 10)) > 0 And Len(oWS.Cells(r, 4)) > 0 Then
oWS.Cells(r, 11).Value = oWS.Cells(r, 4).Value & " " & oWS.Cells(r, 10).Value
End If
Next
End Sub
Ive looked through past threads and got this far, but some of my cells are blank in column J&D but would still like to combine the data.
What do I need to change to make this happen I'm guessing its something to do with the writing in green but not to sure what to change it to.
Sub CombineCols()
Dim oWS As Worksheet, lLastRow As Long, r As Long
Set oWS = ActiveSheet
lLastRow = oWS.Cells.SpecialCells(xlLastCell).row
For r = 1 To lLastRow
If Len(oWS.Cells(r, 10)) > 0 And Len(oWS.Cells(r, 4)) > 0 Then
oWS.Cells(r, 11).Value = oWS.Cells(r, 4).Value & " " & oWS.Cells(r, 10).Value
End If
Next
End Sub