Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to merge and format selected cell
I want to create a macro that will merge the selected cell with the one next
to it (on the right) and format it to align left. When this macro runs, I would like for it to perform the action in whichever cell is selected and not the cells that are referenced while recording the macro. I hope this makes sense! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to merge and format selected cell
Taylor,
How about: Sub MergeCells() With Selection .Resize(1, 2).MergeCells = True .Resize(1, 2).HorizontalAlignment = xlLeft End With End Sub regards Pete "Taylor" wrote: I want to create a macro that will merge the selected cell with the one next to it (on the right) and format it to align left. When this macro runs, I would like for it to perform the action in whichever cell is selected and not the cells that are referenced while recording the macro. I hope this makes sense! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to merge and format selected cell
Just what I needed! Thanks for such a speedy response!
"Pete Rooney" wrote: Taylor, How about: Sub MergeCells() With Selection .Resize(1, 2).MergeCells = True .Resize(1, 2).HorizontalAlignment = xlLeft End With End Sub regards Pete "Taylor" wrote: I want to create a macro that will merge the selected cell with the one next to it (on the right) and format it to align left. When this macro runs, I would like for it to perform the action in whichever cell is selected and not the cells that are referenced while recording the macro. I hope this makes sense! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to merge and format selected cell
You're welcome! :-)
Pete "Taylor" wrote: Just what I needed! Thanks for such a speedy response! "Pete Rooney" wrote: Taylor, How about: Sub MergeCells() With Selection .Resize(1, 2).MergeCells = True .Resize(1, 2).HorizontalAlignment = xlLeft End With End Sub regards Pete "Taylor" wrote: I want to create a macro that will merge the selected cell with the one next to it (on the right) and format it to align left. When this macro runs, I would like for it to perform the action in whichever cell is selected and not the cells that are referenced while recording the macro. I hope this makes sense! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
create macro "merge selected cells"? | Excel Programming | |||
Macro to Saved Selected Excel data to .CSV format | Excel Discussion (Misc queries) | |||
write a macro that changes format of selected cells | Excel Programming | |||
Macro to take selected cells times a selected cell | Excel Programming | |||
Macro to format selected cells | Excel Programming |