VBA Code for Changing Text Alignment with Merge Cells

Tennisguuy

Well-known Member
Joined
Oct 17, 2007
Messages
559
Office Version
  1. 2016
Platform
  1. Windows
I am not sure if this can be done and I am not good with writing VBA code. I have a spreadsheet where I have merged some cells. I have instructions in the merged cells. I have it formatted to show the instructions in red and aligned center because that is the option I liked best under merged cells. When the user inputs their text the instructions in red then turns to black but the alignment is still centered.

What I would like to do is leave the current formatting in where the instructions are in red and aligned centered but when the user types over the instructions and it changes it to black and keeps the center alignment I would like to change the alignment from center after they input text in the cell to left alignment.

Can that be done.

I have merged cells in four separate places on the worksheet. The first set merging row 10-14, then 18-22 then 46-50 and 53-57
 

Tennisguuy

Well-known Member
Joined
Oct 17, 2007
Messages
559
Office Version
  1. 2016
Platform
  1. Windows
Actually the merged cells start with column B sorry about that. Column A was hidden. However I changed your code that had A with B. That didn't work either. I am not sure if this matter but the alignment on the home tab was in the center position and the merge drop down was Merge & Center
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
58,246
Office Version
  1. 365
Platform
  1. Windows
As I said before, VBA & merged cells don't work well together. Because of that, I don't touch merged cells so not sure what will work & what wont.
 
Solution

Tennisguuy

Well-known Member
Joined
Oct 17, 2007
Messages
559
Office Version
  1. 2016
Platform
  1. Windows
Ok thanks Fluff no problem. I really really appreciate your help in trying to help me.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
58,246
Office Version
  1. 365
Platform
  1. Windows
Glad to help & thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,132,914
Messages
5,655,937
Members
418,253
Latest member
TheJackal26

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