Automatically merge cells

tonyjyoo

Board Regular
Joined
Aug 5, 2016
Messages
167
Can anyone help me with a VBA script to automatically merge cells that are lettered down A,B,C, etc. in 1 single column? For example, letter "A" might possess only 2 cells, but letter "B" could carry 2 or more, etc. Is there a way to automatically merge each "lettered" group of cells automatically, according to each letter down the column?

Let me know if this is not clear.

Thanks,
Tony
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
post a table with all borders showing what you mean
 
Upvote 0
post a table with all borders showing what you mean

Basically the first worksheet has the full year's calendar on the page, with each month and all days listed out.

In my second worksheet where employees input their PTO schedule, it looks something like this...
[TABLE="width: 500"]
<tbody>[TR]
[TD]Name
[/TD]
[TD]Date From[/TD]
[TD]Date To[/TD]
[TD]Days[/TD]
[/TR]
[TR]
[TD]Tony[/TD]
[TD]1/20/16[/TD]
[TD]1/20/16[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Tony[/TD]
[TD]11/9/16[/TD]
[TD]11/14/16[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]Dan[/TD]
[TD]3/14/16[/TD]
[TD]3/14/16[/TD]
[TD]0.5[/TD]
[/TR]
</tbody>[/TABLE]

I want my first worksheet, the tab with the year's full calendar, to look at the second and see according to the data entered for "dates from and to", as well as days (0.5 for half day taken) and highlight that calendar day in my first worksheet and enter the employee's name.
 
Upvote 0
post a table with all borders showing what you mean
[TABLE="width: 500"]
<tbody>[TR]
[TD]Group[/TD]
[TD]Description[/TD]
[TD]$[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]Deposit[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Deposit[/TD]
[TD]-100[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]Check 1[/TD]
[TD]50[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Check 1[/TD]
[TD]-50[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]Payment[/TD]
[TD]500[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]item 1[/TD]
[TD]-100[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]item 2[/TD]
[TD]-200[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]item 3[/TD]
[TD]-50[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]item 4[/TD]
[TD]-150[/TD]
[/TR]
</tbody>[/TABLE]

Sorry I posted wrong answer. Please see above. As you can see, I would want to merge the A's, B's, and C's together accordingly.
 
Upvote 0
[TABLE="width: 500"]
<tbody>[TR]
[TD]Group[/TD]
[TD]Description[/TD]
[TD]$[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]Deposit[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Deposit[/TD]
[TD]-100[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]Check 1[/TD]
[TD]50[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Check 1[/TD]
[TD]-50[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]Payment[/TD]
[TD]500[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]item 1[/TD]
[TD]-100[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]item 2[/TD]
[TD]-200[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]item 3[/TD]
[TD]-50[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]item 4[/TD]
[TD]-150[/TD]
[/TR]
</tbody>[/TABLE]

Sorry I posted wrong answer. Please see above. As you can see, I would want to merge the A's, B's, and C's together accordingly.

bump please.
 
Upvote 0
bump please.

So you want to merge column A cells vertically to the next letter? In this I mean that you would merge (A) A1:A2, (B) A3:A4, (C) A5:A8. The overall effect would result in 3 cells to select. I ALSO PRESUME YOU WANT THE CODE TO CHECK THE VALUE OF THE CELLS to determine which need to be merged. Sorry about the CAPS.
 
Upvote 0

Forum statistics

Threads
1,226,693
Messages
6,192,471
Members
453,726
Latest member
JoeH57

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