PC Review


Reply
Thread Tools Rate Thread

create macro "merge selected cells"?

 
 
Mamoudou
Guest
Posts: n/a
 
      22nd Dec 2007
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.
 
Reply With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      22nd Dec 2007
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.

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      22nd Dec 2007
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
 
Reply With Quote
 
Mamoudou
Guest
Posts: n/a
 
      22nd Dec 2007


"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".

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      22nd Dec 2007
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
 
Reply With Quote
 
Mamoudou
Guest
Posts: n/a
 
      22nd Dec 2007
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
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      22nd Dec 2007
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
 
Reply With Quote
 
Mamoudou
Guest
Posts: n/a
 
      22nd Dec 2007

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
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Center across selection" rather than "Merge cells" Elardus Microsoft Excel Misc 10 6th Nov 2008 02:28 PM
Why "center across selection" rather than "merge" cells? What is. =?Utf-8?B?TWljaGVsZQ==?= Microsoft Excel Misc 7 5th Nov 2008 04:36 AM
Macro to add the " symbol to the beginning and end of cells selected Stuart Microsoft Excel Programming 1 20th Apr 2008 11:05 PM
Create a "cell button" to hide selected cells. =?Utf-8?B?U2hvb2xpbiBQYXRlbA==?= Microsoft Excel Worksheet Functions 12 30th Jul 2007 11:00 AM
"Play a selected sound" in "create Rule" =?Utf-8?B?VHJpc2g=?= Microsoft Outlook 1 2nd Sep 2006 01:37 AM


Features
 

Advertising
 

Newsgroups
 


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