Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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 | |
|
|
![]() |
||||
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 |