View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tony Scullion Tony Scullion is offline
external usenet poster
 
Posts: 4
Default Turning off all screen updates during a Solver routine

Hi Group,

I have a form button on a worksheet(The Best Team), which
when clicked, runs VBA code (provided below) to run a
Solver routine.

Is there any way that I can turn off all the screen
updates so that when I click the button all I get its the
returned results of the Solver routine without viewing it
all happen on screen?

Many thanks

Tony

'Code

Sub FindtheBestTeam()

Application.ScreenUpdating = False

Sheets("Data").Visible = True 'Unhide Data worksheet
Sheets("Data").Select
Range("K6").Select

'Start of Solver Routine
SolverOk SetCell:="$O$6", MaxMinVal:=1, ValueOf:="0",
ByChange:="$K$6:$K$203"
SolverSolve UserFinish:=True 'Do not show any dialog
boxes
' End of Solver Routine

Range("K5").Select
Selection.AutoFilter
Range("K5").Select
Selection.AutoFilter Field:=6, Criteria1:="1"

'Copy the filtered results using excellent generic code
'provided by Tom Oglivy
Call CopyFilter

'Switch off autofilter
Sheets("Data").Select
Range("K5").Select
Selection.AutoFilter Field:=1
Range("K5").Select
Selection.AutoFilter
Range("F6").Select
Sheets("The Best Team").Select
Range("F18").Select

'Hide the Data sheet
Sheets("Data").Visible = False
'View the Best Team
Sheets("The Best Team").Select
Application.ScreenUpdating = True
End Sub