Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
create macro "merge selected cells"? Mamoudou Excel Programming 7 December 22nd 07 10:57 PM
Macro to Saved Selected Excel data to .CSV format joelbeveridge Excel Discussion (Misc queries) 18 August 8th 06 12:59 PM
write a macro that changes format of selected cells DKY[_112_] Excel Programming 2 March 29th 06 08:34 PM
Macro to take selected cells times a selected cell Craig Excel Programming 4 October 24th 05 12:54 AM
Macro to format selected cells BeSmart[_2_] Excel Programming 4 May 7th 04 01:28 PM


All times are GMT +1. The time now is 08:19 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"