Concatenate and Bold two columns

loisl

New Member
Joined
Feb 8, 2019
Messages
3
This is so stupid but I have been googling for ages and still can't figure out how I've done this before so I'm hoping someone can help!

I have two columns - A and B. I want to join A to B into column C, but keep the format of column A bold. I'm sure the macro for this is straightforward but I honestly can't remember it. Can anyone help? Thanks!
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

gallen

Well-known Member
Joined
Jun 27, 2011
Messages
2,006
Hello and welcome.

Wasn't sure which columns you wanted bold but that is easy enough. This code will need altering to suit your data. Make sure to test on a COPY...:D

Code:
Sub ConcatenateColumns()


    'assuming data starts on row 1


    Dim lr As Long 'last row in column a & b (used for both)
    Dim nr As Long 'next blank row in column c
    
    
    'last row in col A
    lr = Range("A" & Rows.Count).End(xlUp).Row
    
    'copy column A to start of column C.
    Range("A1:A" & lr).Copy Range("C1")
    
    'last row in col B
    lr = Range("B" & Rows.Count).End(xlUp).Row
    
    'last row in col c
    nr = Range("C" & Rows.Count).End(xlUp).Row + 1
    
    'copy column A to start of column C
    Range("B1:B" & lr).Copy Range("C" & nr)
    
    'To set a column to Bold:
    Range("C1").EntireColumn.Font.Bold = True
    
    
End Sub
 

bobsan42

Well-known Member
Joined
Jul 14, 2010
Messages
1,393
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2013
Platform
  1. Windows
If I understand correctly, you want the text in column C which came from column A to be bold.
Try this:
Code:
    With Range("C1")        .Value = .Offset(0, -2).Value & " " & .Offset(0, -1).Value
        .Characters(Start:=1, Length:=Len(.Offset(0, -2).Value)).Font.FontStyle = "Bold"
    End With
I will leave to you to sort out the ranges and the loops :)
 

loisl

New Member
Joined
Feb 8, 2019
Messages
3
Thanks, I think I didn't explain this very well! I have
A1: John Smith B1: Organisation

and want to make

A1: John Smith B1: Organisation C1: John Smith Organisation

I managed to do it yesterday but only for row A, and have now lost the code I used. Going swimmingly!
 

loisl

New Member
Joined
Feb 8, 2019
Messages
3
I've done it in HTML so we can all stand down! Thanks for the suggestions, I will endeavour to improve my skills so I don't cheat next time!
 

Watch MrExcel Video

Forum statistics

Threads
1,129,552
Messages
5,636,975
Members
416,953
Latest member
broexc

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
Top