Combining text in two merged cells

alexg7828

New Member
Joined
Aug 4, 2017
Messages
22
I have two merged groups of cells, both with multi line text and name as ranges (Range1 and Range2) both can be varying lengths.

I have a form, if a specified check box is ticked i want to copy the text in Range 2 to Range 1 with a line break and then format the Range 2 text to bold red.

I was thinking something like below but cant quite work out wether it should be a copy, concenate or something different ... or impossible.

VBA Code:
If check_DemInfo.Value = True Then
    Range("Range1").Copy
    Range("Temp_1").PasteSpecial xlPasteValues
    Range("Temp_1").PasteSpecial xlPasteFormats
    Range("Range2").Copy
    Range("Temp_2").PasteSpecial xlPasteValues
    Range("Temp_2").PasteSpecial xlPasteFormats
    Range("Range1").Value = Range("Temp_1") & Range("Temp_2")
End If
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
copy the text in Range 2 to Range 1 with a line break and then format the Range 2 text to bold red.

If you want in red bold the part2 that was added to the cell
Before Something like this:
1590358783336.png


After:
1590358806550.png


Then, try this:

VBA Code:
Sub CopyData()
  Dim n As Long
  With Range("Range1")
    .Font.Bold = False
    n = Len(.Value)
    .Value = .Value & Chr(10) & Range("Range2").Value
    With .Characters(n + 2, Len(Range("Range2").Value)).Font
      .Bold = True
      .Color = vbRed
    End With
  End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,523
Messages
6,120,047
Members
448,940
Latest member
mdusw

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