View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Ken Puls Ken Puls is offline
external usenet poster
 
Posts: 58
Default Allowing user to merge cells

Sorry, protecting the worksheet disables the merge feature.

The only way you'd be able to do this that I am aware of is to write a
macro to:
-unprotect the sheet
-merge the cells
-reprotect the sheet

If you want to go that route, then go into your workbook and:
-Press Alt+F11 to open the Visual Basic Editor (VBE)
-Press Ctrl+R to show the project (windows looking) explorer
-Navigate through until you find your project and expand it
-Right click one of the objects in your project and choose Insert-- Module
-In the pane that shows up at right, paste the following code:

Sub MergeProtected()
Const myPassword = "password"

With ActiveSheet
If .ProtectContents = True Then
.Unprotect myPassword
Selection.Cells.Merge
.Protect myPassword
Else
Selection.Cells.Merge
End If
End With
End Sub

-Change the password (between the quotes) to the password you want to
use to protect the sheet
-Exit the VBE
-Save your workbook
-Highlight the cells you want to merge, then press Alt+F8
-Choose MergeProtected from the list, and you should have some merged cells.

HTH,

Ken Puls, CMA - Microsoft MVP (Excel)
www.excelguru.ca

Lavanya wrote:
how can i allow users to merge cells when i protect the worksheet? I dont see
the open in the dialog box.