View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Getting value from a TextBox to a vbs script???

I assume you mean a worksheet textbox off of the control toolbox.

Replace this

With Worksheets("sheet1")
Set CellWithName = .Range("A1")
If Trim(CellWithName.Value) = "" Then
MsgBox "Please type something"
Exit Sub
End If


with this

With Worksheets("sheet1")
Set CellWithName = .Textbox.Text
If Trim(CellWithName.Value) = "" Then
MsgBox "Please type something"
Exit Sub
End If


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"kandinsky " wrote in message
...
Hi. I am using this piece of code - kindly supplied by DaveP - to search
for cells containg certain names:

:::::START:::::::::::::::::::::::::::::::
Option Explicit
Sub SearchForName()

Dim FoundCell As Range
Dim CellWithName As Range


With Worksheets("sheet1")
Set CellWithName = .Range("A1")
If Trim(CellWithName.Value) = "" Then
MsgBox "Please type something"
Exit Sub
End If

With .Range("a2", .Cells(.Rows.Count, "A").End(xlUp))
Set FoundCell = .Cells.Find(What:=CellWithName.Value, _
After:=.Cells(.Cells.Count), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False)
End With

If FoundCell Is Nothing Then
MsgBox "not there"
Else
Application.Goto reference:=FoundCell, Scroll:=True
End If
End With

End Sub

:::::END::::::::::::::::::::::::::::::

Can i use a textbox in my worksheet as the datainput instead? (And
how). If i fx. make a TextBox and call it sString, how do I get the
value from whatevers in it, into the script above?

Cheers...


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