Prev: Hashing function CryptAcquireContext Lib "advapi32" not working in new computer.
Next: change Pivot table
From: gwinder on 5 Jan 2007 13:13 When I protect a sheet I get the following message when trying to enter text into a cell: Unable to set the MergeCells property of the Range Class I do have code that that allows automatic wrap of text in merged cells. Is there something I need to modify in the code? Thanks Gary
From: JLatham HelpFrom on 5 Jan 2007 13:27 The fact that it is a Run-Time error and the rest of the message leads me to think that there is some code attached to that worksheet or elsewhere that is trying to put text into the cells. The code probably also tries to set the text wrap properties. The cell is locked, so when you protect the sheet, the code is unable to modify the content/format of the cell(s). Next time it comes up, or you force the error, there should be 2 buttons on the error message dialog: [End] [Debug]. Try hitting debug and see where you are - the offending line in the VBA code will be highlighted. Now, what you do after that, is entirely dependent on what you're trying to do in general. "gwinder" wrote: > When I protect a sheet I get the following message when trying to enter text > into a cell: > > Unable to set the MergeCells property of the Range Class > > I do have code that that allows automatic wrap of text in merged cells. > > Is there something I need to modify in the code? > > Thanks > > Gary
From: gwinder on 5 Jan 2007 14:07 Thanks. OK...the offending line in my code is: ma.MergeCells = False My code is to allow the text to wrap in merged cells Gary "JLatham" wrote: > The fact that it is a Run-Time error and the rest of the message leads me to > think that there is some code attached to that worksheet or elsewhere that is > trying to put text into the cells. The code probably also tries to set the > text wrap properties. The cell is locked, so when you protect the sheet, the > code is unable to modify the content/format of the cell(s). > > Next time it comes up, or you force the error, there should be 2 buttons on > the error message dialog: [End] [Debug]. Try hitting debug and see where you > are - the offending line in the VBA code will be highlighted. Now, what you > do after that, is entirely dependent on what you're trying to do in general. > > "gwinder" wrote: > > > When I protect a sheet I get the following message when trying to enter text > > into a cell: > > > > Unable to set the MergeCells property of the Range Class > > > > I do have code that that allows automatic wrap of text in merged cells. > > > > Is there something I need to modify in the code? > > > > Thanks > > > > Gary
From: JLatham HelpFrom on 5 Jan 2007 19:28
If the cells are already merged and formatted, you can simply delete the offending line(s) [there may be more to encounter later]. Or you can put On Error Resume Next in front of all of the formatting code and then put On Error Goto 0 after it is all done. Only problem with that is that if another, more consequential error takes place in there, then you won't know about it. "gwinder" wrote: > Thanks. OK...the offending line in my code is: > > ma.MergeCells = False > > My code is to allow the text to wrap in merged cells > > Gary > > "JLatham" wrote: > > > The fact that it is a Run-Time error and the rest of the message leads me to > > think that there is some code attached to that worksheet or elsewhere that is > > trying to put text into the cells. The code probably also tries to set the > > text wrap properties. The cell is locked, so when you protect the sheet, the > > code is unable to modify the content/format of the cell(s). > > > > Next time it comes up, or you force the error, there should be 2 buttons on > > the error message dialog: [End] [Debug]. Try hitting debug and see where you > > are - the offending line in the VBA code will be highlighted. Now, what you > > do after that, is entirely dependent on what you're trying to do in general. > > > > "gwinder" wrote: > > > > > When I protect a sheet I get the following message when trying to enter text > > > into a cell: > > > > > > Unable to set the MergeCells property of the Range Class > > > > > > I do have code that that allows automatic wrap of text in merged cells. > > > > > > Is there something I need to modify in the code? > > > > > > Thanks > > > > > > Gary |