K
KajBre
I have noticed that after showing a user form in VBA macro and placing a
variable value from the user form in a worksheet cell, the Excel-application
is not active.
Example:
'---------------------------------------
' // Show a form to let a user select a product code
frmTuotteet.Show
' // Inside the form the procut codes are shown in a list box
frmTuotteet.lstTuotteet.SetFocus
'(here the form is active until the user has made the selection)
rs.Close ' Close the recordset
Set rs = Nothing
Set conTyomaar = Nothing
' // Check the user seelction
If Trim(Val_Tuote) <> "" Then
' // Place the value in a worksheet cell
Worksheets("Työmääräin").Activate
With ActiveSheet
.Cells(ir, ic).Value = Val_Tuote ' // This is ok
End With
End If
Worksheets("Työmääräin").Activate
'---------------------------------------
After this the worksheet is not active (selected), so a user must click on
the worksheet to continue.
The problem is that I would like to execute another VBA subroutine after the
value from the user form is returned into a worksheet cell, but now this
doesn't work.
Any solutions ?
Kaj B.
variable value from the user form in a worksheet cell, the Excel-application
is not active.
Example:
'---------------------------------------
' // Show a form to let a user select a product code
frmTuotteet.Show
' // Inside the form the procut codes are shown in a list box
frmTuotteet.lstTuotteet.SetFocus
'(here the form is active until the user has made the selection)
rs.Close ' Close the recordset
Set rs = Nothing
Set conTyomaar = Nothing
' // Check the user seelction
If Trim(Val_Tuote) <> "" Then
' // Place the value in a worksheet cell
Worksheets("Työmääräin").Activate
With ActiveSheet
.Cells(ir, ic).Value = Val_Tuote ' // This is ok
End With
End If
Worksheets("Työmääräin").Activate
'---------------------------------------
After this the worksheet is not active (selected), so a user must click on
the worksheet to continue.
The problem is that I would like to execute another VBA subroutine after the
value from the user form is returned into a worksheet cell, but now this
doesn't work.
Any solutions ?
Kaj B.