ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Merging cells in a table (https://www.excelbanter.com/excel-programming/424153-merging-cells-table.html)

John

Merging cells in a table
 
I have a named range table of multiple 9 column rows and am using the
following code to load cells 5 and 9 in the j-th row of the table:
Sheets(ToSheet).Range(ToTable)(j, 5).Value = "aaa"
Sheets(ToSheet).Range(ToTable)(j, 9).Value = "bbb"
What code would merge cells 5 thru 9 of row j+1 to a single cell.

I appreciate your help, -John

Dave Peterson

Merging cells in a table
 
Worksheets(ToSheet).Range(ToTable)(j, 5).Resize(1, 5).Merge Across:=True

The Across parm is very nice if you wanted to merge multiple rows into multiple
cells (instead of looping through each row).

John wrote:

I have a named range table of multiple 9 column rows and am using the
following code to load cells 5 and 9 in the j-th row of the table:
Sheets(ToSheet).Range(ToTable)(j, 5).Value = "aaa"
Sheets(ToSheet).Range(ToTable)(j, 9).Value = "bbb"
What code would merge cells 5 thru 9 of row j+1 to a single cell.

I appreciate your help, -John


--

Dave Peterson


All times are GMT +1. The time now is 11:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com