ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Allowing user to merge cells (https://www.excelbanter.com/excel-discussion-misc-queries/119885-allowing-user-merge-cells.html)

Lavanya

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

Ken Puls

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.



All times are GMT +1. The time now is 11:03 PM.

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