Merge cells with data that was generated using a formula

paulabrink78

New Member
Joined
May 28, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I have a spreadsheet - it also contains a Macro - that completes a Gantt chart with a country name and Time Zone. This is done by a very smart formula that I did not build myself but had lost of help with. I, now want to merge these cells so you can see the name of the country and UTC nicely. Doing it manually will defeat the point of trying to make this sheet as automated as possible.

I was advised that this should be done in VBA...

I would be greateful for any ideas.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Can you add the macro here? It is a simple concatenate but as to how it will fit in to your code that is different matter.

The code below looks at the two cells in my data and combines the cell contents into a single cell keeping the time format. Not neccisarily the correct method for you. Would also need to know where you want the combined result to go.

1717765442770.png


VBA Code:
Sub MergeStuff()

Range("C2:C7").select

For Each i In Selection

i.Offset(0, 2).Select
i.Value = i.Offset(0, -2).Value & " - " & Format(i.Offset(0, -1).Value, "hh:mm")

Next i

End Sub
 
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