steve case
Well-known Member
- Joined
- Apr 10, 2002
- Messages
- 823
Yes, I really do want to merge cells!
I have several columns "A" thru "J" with simple contents, part#, qty, date, etc. and in column "K" descriptive text which can run several sentences long.
I'm trying to record a macro to insert a row, merge "A" thru "J" in that new row, cut the text from the "K" cell in the row above and select wrap text so it shows up below those headings so my user can read it.
Would look like:
part#, qty, date, etc, etc, etc, etc, etc, etc, etc
Blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah
I can get it to look like that if I grab the row borders and drag it to fit, but can I get it to increase row height and wrap to fit the text length automatically with the macro?
Code looks like this so far:
Dialog box pops up "This operation will cause some merged cells to unmerge. Do you wish to continue"
I'm going to have a shortcut key in the macro to do this one row at a time, as the data isn't that extensive, but I don't want to have to drag all the row heights.
I have several columns "A" thru "J" with simple contents, part#, qty, date, etc. and in column "K" descriptive text which can run several sentences long.
I'm trying to record a macro to insert a row, merge "A" thru "J" in that new row, cut the text from the "K" cell in the row above and select wrap text so it shows up below those headings so my user can read it.
Would look like:
part#, qty, date, etc, etc, etc, etc, etc, etc, etc
Blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah
I can get it to look like that if I grab the row borders and drag it to fit, but can I get it to increase row height and wrap to fit the text length automatically with the macro?
Code looks like this so far:
Code:
Keyboard Shortcut: Ctrl+Shift+M
Application.CutCopyMode = False
Selection.Insert Shift:=xlDown
Range("A3:J3").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("K2").Select
Selection.Cut
Range("A3:J3").Select
ActiveSheet.Paste
Rows("5:5").Select
Dialog box pops up "This operation will cause some merged cells to unmerge. Do you wish to continue"
I'm going to have a shortcut key in the macro to do this one row at a time, as the data isn't that extensive, but I don't want to have to drag all the row heights.