Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Run macro in protected worsheets

Hi

I have made some macros that among other things gets data from SQLserver
with QueryTables. And it works fine.

The problem is: The Worksheets should be protected, and I have tried to put
unprotect first in the code, and protect in the end of the code. Unprotect
works fine, but the protection takes effect too early, so I get the error
message: Can not write to protected cells.

I use .RefreshBackgroundQuery=True

Is there any way to say that all code should be executed (and finished)
before the next code line can start?

Frank


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 143
Default Run macro in protected worsheets

suggest you protekt sheet with userinterfaceonly set so macro can rite with
sheet prtected

Sheet1.Protect "pass", True, True, True, True
Range("A1").Value = "CanWriteEvenWithSheetLocked"

userinterfaceonly is 4th true above.

"frankgtl" wrote in message
...
| Hi
|
| I have made some macros that among other things gets data from SQLserver
| with QueryTables. And it works fine.
|
| The problem is: The Worksheets should be protected, and I have tried to
put
| unprotect first in the code, and protect in the end of the code. Unprotect
| works fine, but the protection takes effect too early, so I get the error
| message: Can not write to protected cells.
|
| I use .RefreshBackgroundQuery=True
|
| Is there any way to say that all code should be executed (and finished)
| before the next code line can start?
|
| Frank
|
|

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
comparing 2 worsheets using a macro louie Excel Programming 1 November 25th 08 02:07 AM
duplicating worsheets Don Excel Worksheet Functions 2 November 28th 06 07:11 PM
Linking 2 Worsheets Mike_C Links and Linking in Excel 3 August 10th 05 11:14 PM
Multiple worsheets DavidL Excel Programming 1 February 23rd 04 08:10 PM
Hidden Worsheets Shamsul Islam Excel Programming 1 February 16th 04 11:34 AM


All times are GMT +1. The time now is 05:30 AM.

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

About Us

"It's about Microsoft Excel"