Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Validation error when worksheet is protected

Hi,

Below code works fine as long as I do not protect my workbook, but gives an
error when protected. How to solve this ?

Runtime error '-2147417848 (80010108)'
Method 'Modify' of object 'Validation failed'

With Worksheets(1).Range("G14").Validation
.Modify xlValidateDecimal, xlValidAlertStop, xlBetween, "1.0", "7.0"
.ErrorMessage = "Enter value between 1,0 and 7,0" + EOL + "Use end of
line"
.ShowInput = False
.ErrorTitle = "Invalid input"
.ShowError = True
End With

I've already tried ActiveWorkbook.Unprotect, Add Type iso Modify and
Validation.delete before add / modify. None of these alternatives seem to
work.
Cell G14 is not locked and not hidden.

Why is protect workbook causing this error, and how to solve this ?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Validation error when worksheet is protected

If you unprotect your workbook in code, execute the command and reprotect the
workbook (all in code) and you say that a protected workbook is the cause of
the problem, then that should fix it.

--
Regards,
Tom Ogilvy


"Tom Emmery" wrote:

Hi,

Below code works fine as long as I do not protect my workbook, but gives an
error when protected. How to solve this ?

Runtime error '-2147417848 (80010108)'
Method 'Modify' of object 'Validation failed'

With Worksheets(1).Range("G14").Validation
.Modify xlValidateDecimal, xlValidAlertStop, xlBetween, "1.0", "7.0"
.ErrorMessage = "Enter value between 1,0 and 7,0" + EOL + "Use end of
line"
.ShowInput = False
.ErrorTitle = "Invalid input"
.ShowError = True
End With

I've already tried ActiveWorkbook.Unprotect, Add Type iso Modify and
Validation.delete before add / modify. None of these alternatives seem to
work.
Cell G14 is not locked and not hidden.

Why is protect workbook causing this error, and how to solve this ?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Validation error when worksheet is protected

Hi Tom,

I've tried unprotect before (and protect after) below code, but this doesn't
change the error.

ActiveWorkbook.Unprotect

Or should I use other code to resolve ?

Greets,

Tom
"Tom Ogilvy" wrote:

If you unprotect your workbook in code, execute the command and reprotect the
workbook (all in code) and you say that a protected workbook is the cause of
the problem, then that should fix it.

--
Regards,
Tom Ogilvy


"Tom Emmery" wrote:

Hi,

Below code works fine as long as I do not protect my workbook, but gives an
error when protected. How to solve this ?

Runtime error '-2147417848 (80010108)'
Method 'Modify' of object 'Validation failed'

With Worksheets(1).Range("G14").Validation
.Modify xlValidateDecimal, xlValidAlertStop, xlBetween, "1.0", "7.0"
.ErrorMessage = "Enter value between 1,0 and 7,0" + EOL + "Use end of
line"
.ShowInput = False
.ErrorTitle = "Invalid input"
.ShowError = True
End With

I've already tried ActiveWorkbook.Unprotect, Add Type iso Modify and
Validation.delete before add / modify. None of these alternatives seem to
work.
Cell G14 is not locked and not hidden.

Why is protect workbook causing this error, and how to solve this ?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro error when worksheet is protected Soroya1920 Excel Discussion (Misc queries) 2 August 27th 07 06:42 PM
1004 Cell Protected Error for data validation lists when locked and protected [email protected] Excel Programming 2 November 7th 06 10:07 AM
error accessing a protected worksheet Erik Jahre Excel Worksheet Functions 0 February 24th 06 08:32 AM
Validation.Modify Runtime Error in Protected Worksheet Kent Klingler Excel Programming 3 May 13th 04 09:18 PM
Excel VBA error on protected worksheet twcpa Excel Programming 1 January 13th 04 10:18 PM


All times are GMT +1. The time now is 06:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"