Merge & Center across cells when row is a unknown/variable

Kime

New Member
Joined
Apr 22, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I am bringing in raw data and after massaging it, I am formatting headers but I am having difficulty with the vba to select columns a through d when the rows are going to be a variable on a daily basis. After selection, I want the data merged & centered across A through D. Any suggestions or help will be greatly appreciated.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Welcome to the Board!

A piece of advice - don't used merged cells, they are an atrocity that cause all sorts of issues with things like sorting and VBA.
Use the "Center Across Selection" formatting option, as described here: Tom’s Tutorials For Excel: Using Center Across Selection Instead of Merging Cells – Tom Urtis

So, regarding the VBA code, how exactly do you want this to work?
Are you going to be pre-selecting the rows that you want to apply it to?
Are you going to be selecting columns A-D, or do you want it to do that automatically for the rows you have pre-selected?

Or is there some logic that can be used to dynamically determine which rows to apply this to?
 
Upvote 0
Welcome to the Board!

A piece of advice - don't used merged cells, they are an atrocity that cause all sorts of issues with things like sorting and VBA.
Use the "Center Across Selection" formatting option, as described here: Tom’s Tutorials For Excel: Using Center Across Selection Instead of Merging Cells – Tom Urtis

So, regarding the VBA code, how exactly do you want this to work?
Are you going to be pre-selecting the rows that you want to apply it to?
Are you going to be selecting columns A-D, or do you want it to do that automatically for the rows you have pre-selected?

Or is there some logic that can be used to dynamically determine which rows to apply this to?
I got it figured out. Thank you Joe4
 
Upvote 0

Forum statistics

Threads
1,215,131
Messages
6,123,222
Members
449,091
Latest member
jeremy_bp001

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