Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

The idea here is two columns and when data is in column B there is a blank in Column A and you want to combine the two columns.

Sub CombineColumns()

Dim rcell As Range, rng As Range
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("Sheet1")

Set rng = ws.Range("A1:A" & Application.ActiveSheet.UsedRange.Rows.Count)
For Each rcell In rng.Cells

    If IsEmpty(rcell.Value) = True Then

        rcell.Value = rcell.Offset(0, 1).Value
        'MsgBox rcell.Address

    End If
Next rcell

End Sub

  • No labels