View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
bhofsetz[_62_] bhofsetz[_62_] is offline
external usenet poster
 
Posts: 1
Default selecting cell range in other worksheet without switching to worksheet


You can do much of your manipulations without having to select the
ranges on the other sheets. Try simplifying the three lines of code
you had highlighted in red from your first post.

myworksheet.Range(RangeToClear).Select
Selection.ClearContents

change this to

myworksheet.Range(RangeToClear).ClearContents

And likewise for the other problem code

myworksheet.Range(RangeToClear).Select
MsgBox "Clear the second range"
Selection.ClearContents
Change To
MsgBox "Clear the second range"
myworksheet.Range(RangeToClear).ClearContents

myworksheet.Range(IRArray).Select
Selection.FormulaArray = PICompDatFormula
Change To
myworksheet.Range(IRArray).FormulaArray = PICompDatFormula

This should make your code run faster, make it easier to read AND keep
the user from seeing the screen flash as different sheets are selected
plus keep them on the "DYREPMST" worksheet.

Give those changes and let us know if they did the trick.

HTH


--
bhofsetz
------------------------------------------------------------------------
bhofsetz's Profile: http://www.excelforum.com/member.php...o&userid=18807
View this thread: http://www.excelforum.com/showthread...hreadid=380925