gibbo1715
08-28-2005, 03:48 AM
is it possible to set a userform name as a constant so i can make my code as reusable as possible?
I ll give an example in the only way i know how to try and explain what im after, hope this makes sense
Dim formename As String
formname = this userform <----------- need to be able to call this from all other procedures within the userform
for example
Private Sub btnFirst_Click()
DoFill Formname '(i.e.UserForm1) that will then run the code in the standard module
End Sub
'Code in Standard Module
Sub DoFill(UF)
On Error GoTo Err
UF.TextBox1.value = ActiveCell.value
UF.TextBox2.value = ActiveCell.Offset(0, 1).value
UF.TextBox3.value = ActiveCell.Offset(0, 2).value
Exit Sub
Err:
Exit Sub
Any Ideas?
Thanks
Gibbo
I ll give an example in the only way i know how to try and explain what im after, hope this makes sense
Dim formename As String
formname = this userform <----------- need to be able to call this from all other procedures within the userform
for example
Private Sub btnFirst_Click()
DoFill Formname '(i.e.UserForm1) that will then run the code in the standard module
End Sub
'Code in Standard Module
Sub DoFill(UF)
On Error GoTo Err
UF.TextBox1.value = ActiveCell.value
UF.TextBox2.value = ActiveCell.Offset(0, 1).value
UF.TextBox3.value = ActiveCell.Offset(0, 2).value
Exit Sub
Err:
Exit Sub
Any Ideas?
Thanks
Gibbo