LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Unprotecting worksheet, using solver, and re-protecting

Hi,

I am trying to create a macro that allows me to:
1) Unprotect worksheet
2) Run solver (criteria is already defined and stored in solver)
3) Protect worksheet.

I recorded a macro to do this and have added SOLVER to my VBA preferences
but am still receiving an error when I run the macro. My code is below. Any
guidance would be much much appreciated.

Sub optimize()
'
' optimize Macro
' This allows you to unprotect the worksheet, run solver, and re-protect the
workshet.
'

'
ActiveSheet.Unprotect

SolverOk(SetCell:="$K$82",MaxMinVal:="1",ValueOf:= "0",ByChange:"$B$65:$I$65")
SolverSolve
userFinish = True
ActiveWindow.SmallScroll Down:=51
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False, AllowFormattingColumns:=True, AllowSorting:=True,
AllowFiltering:= _
True, AllowUsingPivotTables:=True
End Sub

 
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
protecting and unprotecting Fusion1337 Excel Worksheet Functions 5 September 26th 08 04:03 PM
Protecting & Unprotecting worksheet Tammy H Excel Programming 3 September 19th 07 12:58 AM
PROTECTING/UNPROTECTING SHEETS Maureen Excel Discussion (Misc queries) 1 January 6th 05 06:46 PM
Protecting/Unprotecting Workbook Sonny Maou Excel Programming 4 February 18th 04 04:59 PM
Protecting & unprotecting worksheets pkley Excel Programming 1 January 7th 04 10:28 PM


All times are GMT +1. The time now is 03:46 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"