create macro "merge selected cells"?

M

Mamoudou

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

Mike H

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
 
D

Dave Peterson

Share your recorded code.

Sometimes, it's a simple change.

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

Mamoudou

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?
 
D

Dave Peterson

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

I have no idea why MS decided not to include a keyboard shortcut.
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?
 
M

Mamoudou

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top