Private Sub MergeProjectNameColumns() ' I had two columns, A & B. I wanted to move B over only if A was blank. See below. It is based on a selection Range, which you could use to offset the first row, perhaps. Dim rngRowCount As Integer Dim i As Integer 'Loop through column C and simply copy the text over to B if it is not blank rngRowCount = Range(DataRange).Rows.Count ActiveCell.Offset(0, 0).Select ActiveCell.Offset(0, 2).Select For i = 1 To rngRowCount If (Len(RTrim(ActiveCell.Value)) > 0) Then Dim currentValue As String currentValue = ActiveCell.Value ActiveCell.Offset(0, -1) = currentValue End If ActiveCell.Offset(1, 0).Select Next i 'Now delete the unused column Columns("C").Select Selection.Delete Shift:=xlToLeft End Sub
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter