View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter Beach Peter Beach is offline
external usenet poster
 
Posts: 70
Default Hiding the sheets my macro works with...

Hi Gary,

The answer to your question is Application.ScreenUpdating = False.

However there is no reason to use .Select at all. Try something like
(untested I'm afraid)

Sub A()
Dim R2 As Range

Set R2 = Sheet2.Range("B1")

While R2.Value < Pick
Set R2 = R2.Offset(1,0)
Wend

Pick2 = R2.Value
End Sub

HTH

Peter Beach

"Gary Phillips" wrote in message
...
I've got code that opens up sheet2 and searches for specific cells. When

that happens you can briefly see it open up sheet2... Granted it's very
fast, I'd rather have it stay on Sheet1 and just do the work in the
background. Here's my code, how can I do this?

Pick = ComboBox1.Value

Sheet2.Select
Sheet2.Range("B1").Select
Sheet1.Select

While ActiveCell.Value < Pick
Sheet2.Select
Sheet2.Cells(ActiveCell.Row + 1, 2).Select
' TODO: Move the cursor over to the LEFT once
Wend

Sheet2.Cells(ActiveCell.Row, 1).Select
Pick2 = ActiveCell.Value

Sheet1.Select
Sheet1.Range("G5").Select
ActiveCell.Value = Pick2