Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Method 'Range' fails while using AllowEditRanges

I am using Microsoft Access to create a worksheet and I'm having problems
with the code below. I have originally posted this to the Microsoft Access
discussion group and I haven't been able to get the results I need. The
first time I run this, it works correct. The second time I run it, I get a
run time error 1004 Method 'Range" of object '_Global' failed. If I run it a
third time, it works, a fourth time it fails, etc. I have run it first with
the title 'Time' and it works. Then I've changed the title before running it
the second time. But it still fails the second time. Each time I use the
same exact record to test with so it can not be my data. Can you help me?
Thank you

XLSheet.Unprotect
Dim aer As Object
For Each aer In XLSheet.Protection.AllowEditRanges
If aer.Title = "Time" Then
aer.Delete
Exit For
End If
Next
XLSheet.Protection.AllowEditRanges.Add Title:="Time", Range:=Range("$H$" &
Irow & ":$I$" & Mrow - 1)
XLSheet.Protect Password:="cpw1959", DrawingObjects:=True, Contents:=True,
Scenarios:=True

--
Arkansas Lady
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
Range.Group() method fails after 7 calls serhio[_2_] Excel Programming 0 April 24th 08 06:39 PM
Find method fails in hidden range Rick Hansen Excel Programming 2 April 6th 06 10:54 PM
select method of range class fails mark kubicki Excel Programming 12 April 27th 05 02:37 PM
Select method of Range fails J West Excel Programming 1 June 7th 04 02:41 PM
Copy method fails in IIS Domien Excel Programming 0 February 19th 04 02:46 PM


All times are GMT +1. The time now is 06:30 PM.

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"