View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Kelly n espaņol Kelly n espaņol is offline
external usenet poster
 
Posts: 1
Default Hiding the sheets my macro works with...

It is entirely possible to work with the contents of sheet 2 withou
EVER activating or selecting it.

you can use pieces of code such as "Pick2 = Sheet2.Cells(x, 1).Value"

Try replacing ALL of what you posted with ALL of the following:


Code
-------------------

Pick = ComboBox1.Value

x = 1
'by using the x variable to specify the row,
'you can make the While-Loop begin at B1
'automatically, without selecting it

While Sheet2.Cells(x, 2) < Pick
x = x + 1
' TODO: Move the cursor over to the LEFT once
Wend

'the cell in column B which is finally found to
'contain the value of Pick will be Sheet2.Cells(x,2)
'with x being whatever it is when the while-loop ends

Pick2 = Sheet2.Cells(x, 1).Value


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

-------------------



If you replace your first posted version with the new version above
you should still get the result you are looking for.

I am about 99% confident with the replacement that I am posting. I a
no 100% sure because I don't have a clear vision of EVERYTHING you ar
doing with your entire program. That is, I assume that these ten t
twenty lines of code are but a small part of your overall project. S
I would have to know more about the whole thing in order to "guarantee
what I'm proposing.

Nonetheless...

try it!

I think you'll like it

(by the way, you could formulate a similar "fix" in order to enter
value into G5 of sheet 1 without selecting that sheet either.

--
Message posted from http://www.ExcelForum.com