Merging cells in a table

J

John

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
 
D

Dave Peterson

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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top