Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
SetFocus using variable name
I would like to setfocus on a control in a user form
using a variable name. ex: sField = worksheets(5).cells(nval,1) sField.SetFocus The value in worksheets(5).cells(nval,1) would be the name of a control on a user form Can this be done? TIA |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
SetFocus using variable name
Taras,
Try sField = Worksheets(2).Cells(1, 1) Me.Controls(sField).SetFocus -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Taras" wrote in message ... I would like to setfocus on a control in a user form using a variable name. ex: sField = worksheets(5).cells(nval,1) sField.SetFocus The value in worksheets(5).cells(nval,1) would be the name of a control on a user form Can this be done? TIA |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
SetFocus using variable name
Bob,
That did it. Thanks. -----Original Message----- Taras, Try sField = Worksheets(2).Cells(1, 1) Me.Controls(sField).SetFocus -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Taras" wrote in message ... I would like to setfocus on a control in a user form using a variable name. ex: sField = worksheets(5).cells(nval,1) sField.SetFocus The value in worksheets(5).cells(nval,1) would be the name of a control on a user form Can this be done? TIA . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
SetFocus on a different sheet in VBA | Excel Discussion (Misc queries) | |||
SetFocus Problems | Excel Programming | |||
SetFocus problem | Excel Programming | |||
SetFocus method in VBA | Excel Programming | |||
TextBox.SetFocus | Excel Programming |