Macro to combine text

Louise1

New Member
Joined
Aug 20, 2017
Messages
2
Hi all

I'm stuck on this problem and hoping someone can help.

I have a list of data- (up to 1000 rows)
I want to combine the data in rows C and D into column C (with 3 spaces between) then delete column D

i.e.
Before
Column C100 = 0.4
Column D100 = 1A

After
Column C100 = 0.4 1A
Column D100 =

If anyone can help that would be amazing, Thanks!
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Try this:

Code:
Option Explicit


Sub combine()
    Application.ScreenUpdating = False
    Dim c As Range, rng As Range
    Dim lr As Long
    lr = Range("C" & Rows.Count).End(xlUp).Row
    Set rng = Range("C1:C" & lr)
    For Each c In rng
        c = c & "   " & c.Offset(0, 1)
    Next c
    Range("D1").EntireColumn.ClearContents
    Application.ScreenUpdating = True
    MsgBox "Complete"
End Sub
 
Upvote 0
Not totally clear where the list starts so I've assumed it's row 2.
Code:
Dim rng As Range
    Set rng = Range("C2:C" & Range("C" & Rows.Count).End(xlUp).Row)
    With rng
        .Value = Evaluate("INDEX(" & .Address & "&""   ""&" & .Offset(, 1).Address & ",,1)")
        .Offset(, 1).Delete
    End With
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top