ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   create macro "merge selected cells"? (https://www.excelbanter.com/excel-programming/403154-create-macro-merge-selected-cells.html)

Mamoudou

create macro "merge selected cells"?
 
I want to create macros that relate to selected cells, not absolute or
relative references; specifically, merge and unmerge selected cells. Excel in
Office 2003, Win XP.

Mike H

create macro "merge selected cells"?
 
Maybe this in a module

Sub merge()
response = InputBox(" Merge...(m) or Unmerge...(u)")
Select Case UCase(response)
Case "M"
Selection.MergeCells = True
Case "U"
Selection.MergeCells = False
Case Else
MsgBox "Enter M or U"
End Select
End Sub

Mike

"Mamoudou" wrote:

I want to create macros that relate to selected cells, not absolute or
relative references; specifically, merge and unmerge selected cells. Excel in
Office 2003, Win XP.


Dave Peterson

create macro "merge selected cells"?
 
How about just recording a macro when you do it manually?

Mamoudou wrote:

I want to create macros that relate to selected cells, not absolute or
relative references; specifically, merge and unmerge selected cells. Excel in
Office 2003, Win XP.


--

Dave Peterson

Mamoudou

create macro "merge selected cells"?
 


"Dave Peterson" wrote:

How about just recording a macro when you do it manually?

Mamoudou wrote:

I want to create macros that relate to selected cells, not absolute or
relative references; specifically, merge and unmerge selected cells. Excel in
Office 2003, Win XP.


--

Dave Peterson
When I do that, the macro records the references of that instance of merging; when I use the macro at a new location, it is still the original cells that get merged. Hence the need for "Merge Selection".


Dave Peterson

create macro "merge selected cells"?
 
Share your recorded code.

Sometimes, it's a simple change.

Changing a specific range("a1:x1") reference to Selection may work.

Mamoudou wrote:

"Dave Peterson" wrote:

How about just recording a macro when you do it manually?

Mamoudou wrote:

I want to create macros that relate to selected cells, not absolute or
relative references; specifically, merge and unmerge selected cells. Excel in
Office 2003, Win XP.


--

Dave Peterson
When I do that, the macro records the references of that instance of merging; when I use the macro at a new location, it is still the original cells that get merged. Hence the need for "Merge Selection".


--

Dave Peterson

Mamoudou

create macro "merge selected cells"?
 
Thanx for your interest. I have never used code, only recorded the
keystrokes. I should try that, as in the post above. Why is there no keyboard
shortcut?

"Dave Peterson" wrote:

Share your recorded code.

Sometimes, it's a simple change.

Changing a specific range("a1:x1") reference to Selection may work.

Mamoudou wrote:

"Dave Peterson" wrote:

How about just recording a macro when you do it manually?

Mamoudou wrote:

I want to create macros that relate to selected cells, not absolute or
relative references; specifically, merge and unmerge selected cells. Excel in
Office 2003, Win XP.

--

Dave Peterson
When I do that, the macro records the references of that instance of merging; when I use the macro at a new location, it is still the original cells that get merged. Hence the need for "Merge Selection".


--

Dave Peterson


Dave Peterson

create macro "merge selected cells"?
 
In xl2003, there is an icon on the Formatting toolbar.

I have no idea why MS decided not to include a keyboard shortcut.

Mamoudou wrote:

Thanx for your interest. I have never used code, only recorded the
keystrokes. I should try that, as in the post above. Why is there no keyboard
shortcut?

"Dave Peterson" wrote:

Share your recorded code.

Sometimes, it's a simple change.

Changing a specific range("a1:x1") reference to Selection may work.

Mamoudou wrote:

"Dave Peterson" wrote:

How about just recording a macro when you do it manually?

Mamoudou wrote:

I want to create macros that relate to selected cells, not absolute or
relative references; specifically, merge and unmerge selected cells. Excel in
Office 2003, Win XP.

--

Dave Peterson
When I do that, the macro records the references of that instance of merging; when I use the macro at a new location, it is still the original cells that get merged. Hence the need for "Merge Selection".


--

Dave Peterson


--

Dave Peterson

Mamoudou

create macro "merge selected cells"?
 

Thanx, that'll do. That's as simple as using a macro and a lot easier than
creating one. Thanks for all your help.
"Dave Peterson" wrote:

In xl2003, there is an icon on the Formatting toolbar.

I have no idea why MS decided not to include a keyboard shortcut.

Mamoudou wrote:

Thanx for your interest. I have never used code, only recorded the
keystrokes. I should try that, as in the post above. Why is there no keyboard
shortcut?

"Dave Peterson" wrote:

Share your recorded code.

Sometimes, it's a simple change.

Changing a specific range("a1:x1") reference to Selection may work.

Mamoudou wrote:

"Dave Peterson" wrote:

How about just recording a macro when you do it manually?

Mamoudou wrote:

I want to create macros that relate to selected cells, not absolute or
relative references; specifically, merge and unmerge selected cells. Excel in
Office 2003, Win XP.

--

Dave Peterson
When I do that, the macro records the references of that instance of merging; when I use the macro at a new location, it is still the original cells that get merged. Hence the need for "Merge Selection".

--

Dave Peterson


--

Dave Peterson



All times are GMT +1. The time now is 09:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com