properties of object on another sheet
Hi DBAL
Private Sub CommandButton1_Click()
MsgBox Sheet2.TextBox1.Text
MsgBox Sheets(2).TextBox1.Text
MsgBox Sheets("Sheet2").TextBox1.Text
End Sub
Pick the line that suits your needs. Sheet2 is the sheet's code name. It
will stick to the worksheet no matter where you place it or what you rename
it to. Sheets(2) is the second sheet in the workbook at the moment.
Sheets("Sheet2") is the one named Sheet2, no matter where it's located.
HTH. Best wishes Harald
"DBAL" skrev i melding
...
Hey everyone! I'm stuck on this. I need to set a string
variable in the VBA for Sheet1 with the value stored in
the Text property of a TextBox on Sheet2. Is there a way
to reference an object from another sheet within the same
workbook?
Something like this:
Dim strServerName, strDatabaseName As String
strServerName = ??Sheets("Sheet2").??.txtServerName.Text
strDatabaseName = ?????????.txtDatabaseName.Text
Please advise.
DBAL
|