I think this is a simple question but because i'm new to VBA coding its a mindbreaker for me...
I'm building a simple userform so the user can put in the values in a form instead of the Excel worksheet. In this userform there are nummers like 1,20 (comma separated numbers) when these numbers are placed on the worksheet there is no calculation made when I enter an number without a comma the calculation is being made (at the worksheet i want to keep the calculations, I do not want to transfer the calculations to the VBA, this is more convienient for me)
When I enter the "fresh value" direct is the worksheet cel the calculation is made... What am I doing wrong???
I've seen that I have to calculate or activate the sheet so I can Write DIRECT into the sheet, Please help. ;-)
Here the code I'm using...
-----------------------------------------------------------------------------------------
Option Explicit
Private Sub UserForm_Initialize()
Dim hWnd As Long, lStyle As Long
If Val(Application.Version) >= 9 Then
hWnd = FindWindow("ThunderDFrame", Me.Caption)
Else
hWnd = FindWindow("ThunderXFrame", Me.Caption)
End If
lStyle = GetWindowLong(hWnd, GWL_STYLE)
SetWindowLong hWnd, GWL_STYLE, (lStyle And Not WS_SYSMENU)
End Sub
Private Sub CmdClose_Click()
Unload Me
End Sub
Private Sub CommandButton1_Click()
Dim ws As Worksheet
Set ws = Worksheets("Quality Evidence Testvorm")
Worksheets("Quality Evidence Testvorm").Range("K10").Value = Me.TextBox1.Value
Worksheets("Quality Evidence Testvorm").Range("K11").Value = Me.TextBox2.Value
Worksheets("Quality Evidence Testvorm").Range("K13").Value = Me.TextBox3.Value
MsgBox "De informatie is voor het QE protocol opgeslagen"
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If Not MsgBox("Wil je dit venster werkelijk sluiten?", vbYesNo, "Terminate Execution") = vbYes Then
Cancel = True
End If
End Sub
Bookmarks