Results 1 to 3 of 3

Userform textbox dous not write to the worksheet

Threaded View

  1. #1
    Registered User
    Join Date
    02-04-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    2

    Userform textbox dous not write to the worksheet

    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
    Last edited by Mieska; 02-10-2012 at 07:31 PM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1