Display all the items of a listbox (userform) in specific merged cells ?

Doflamingo

Board Regular
Joined
Apr 16, 2019
Messages
238
Hi all,

I try to design an automate structure/organizational chart and I'm just at the Beginning of my project

First, Here is the code of the List Box with the button of the macro that displays all the items contained in the listbox


Private Sub CommandButton_Click()

Dim I As Long

For I = 0 To ListBox1.ListCount - 1

Cells(1, I + 1) = ListBox1.List(I)

end sub

All the items of the listbox are displayed in a page of an excel spreadsheet in the same row in different columns, like that :
Item A (one column) Item B (one column) Item C (one column) etc.

but what I would like is to have all the items displayed like that ;
item A in a merged cell (2 colums), Empty column, item B in a merged cell (2 colums), Empty column, item C in a merged cell (2 colums), etc.

Any ideas ?:confused:
 
Hi @Joe4

Yes I do understand, I know many of VBA users are against the use of ''merged cells'' that's why I focus on ''Using Center Across Selection Instead of Merging Cells'' instead of trying to merge cells ....

It's perfect when it's ''horizontally'' but vertically that seems impossible

I try to get this

https://www.dropbox.com/s/2g1wpcudvkgs097/dfg.png?dl=0

but what I have currently is that

https://www.dropbox.com/s/zkgujx903p82zwr/Untitled.png?dl=0
 
Upvote 0

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

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