Selecting a cell

  • Thread starter Thread starter abxy
  • Start date Start date
A

abxy

I can't think of anything to solve this lil' doosey

ok, what code could i possibly have to say: if there is an
cell(there's always only one cell) in the entire workbook with the sam
value as textbox1, select it
 
Hi abxy

Private Sub CommandButton1_Click()
Dim myvalue As Double
myvalue = TextBox1 * 1
ActiveSheet.Cells.Find(What:=myvalue).Activate
Unload Me
End Sub


--
XL2002
Regards

William

(e-mail address removed)

| I can't think of anything to solve this lil' doosey
|
| ok, what code could i possibly have to say: if there is any
| cell(there's always only one cell) in the entire workbook with the same
| value as textbox1, select it?
|
|
| ---
| Message posted
|
 
wouldn't that only find a cell on that particular sheet? i need it t
"look thru" the entire workbook
 
abxy

Sorry about that, I read worksheet rather than workbook. Try...

Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Dim myvalue As Double, ws As Worksheet
myvalue = TextBox1 * 1
For Each ws In Worksheets
If Application.CountIf(ws.Cells, myvalue) > 0 Then
ws.Visible = True
ws.Select
ws.Cells.Find(What:=myvalue).Activate
Unload Me
Exit Sub
End If
Next ws
Unload Me
Application.ScreenUpdating = True
MsgBox "No match"
End Sub

--
XL2002
Regards

William

(e-mail address removed)

| wouldn't that only find a cell on that particular sheet? i need it to
| "look thru" the entire workbook.
|
|
| ---
| Message posted
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top