+ Reply to Thread
Results 1 to 6 of 6

Dots removed when data is send to sheet from userform.

Hybrid View

  1. #1
    Registered User
    Join Date
    12-09-2015
    Location
    Netherlands
    MS-Off Ver
    Office 2010 / 2013
    Posts
    9

    Question Dots removed when data is send to sheet from userform.

    Dear all,

    my userform sends the data that the user enters to a sheet, but for some reason suddenly all dots are removed once the data is send.

    I haven't gotten a clue yet where to look in my formula's, but here is a part of the formula which is about the textbox in question. (the form has 36 of these..)
    its about the kind of input that's allowed.

    Private Sub tbNieuwV1_Keypress(ByVal KeyAscii As MSForms.ReturnInteger) 
    If (KeyAscii > 47 And KeyAscii < 58) Or KeyAscii = 46 Then
        KeyAscii = KeyAscii
        Else: KeyAscii = 0: MsgBox ("Invalid entry, only use numbers. For decimals use dots(.)"): End If
    
    End Sub
    the relevant part of the code that sends the data to the sheet looks like this:
        Dim Regis As String
        Regis = Sheets("Uitvoertabel").Range("B" & Rows.Count).End(xlUp).Row
    
        Sheets("Uitvoertabel").Cells(Regis + 1, "BN").Value = tbNieuwV1.Value - tbActueelV1.Value
        Sheets("Uitvoertabel").Cells(Regis + 1, "BQ").Value = tbActueelV1.Value
    It pretty much sends the old stock minus the new stock to the sheet, as well as the new stock. I need this info for Pivot tables.
    A lot more data is send in this part of the formula, but i thought this would be the only relevant part.

    Maybe I messed up some settings or something, but i don't even know where to begin looking right now.. Any help would be greatly appreciated!

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,516

    Re: Dots removed when data is send to sheet from userform.

    Hi there,

    Your code uses a dot as a decimal separator, but is this consistent with the Regional Settings on your Windows installation?

    Your code worked correctly on my installation with Regional Settings selected as English(United Kingdom), but when I changed this setting to Dutch(Netherlands) it produced the error that you're seeing.

    The Regional Settings can be changed via Start >> Control Panel >> Change display language >> Format > select required language.

    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

  3. #3
    Registered User
    Join Date
    12-09-2015
    Location
    Netherlands
    MS-Off Ver
    Office 2010 / 2013
    Posts
    9

    Re: Dots removed when data is send to sheet from userform.

    Hi Greg,

    Thank you for your help!

    I changed the settings to UK for a try, and that worked perfectly. Problem was, that i'd have to do that with every computer that the userform will be used on, so i just changed the code to comma's instead of dots. Works as well, or do i overlook a potential problem here?


    Mathijs

  4. #4
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,516

    Re: Dots removed when data is send to sheet from userform.

    Hi again Mathijs,

    Many thanks for your feedback and also for the Reputation increase - much appreciated

    I don´t think you´re overlooking anything, but I´m away from my computer & Excel for the next two weeks, so I´m not able to do any checks or tests.

    Let me know if you have any further problems & I´ll see what i can do when I get back.

    Best regards,

    Greg M

  5. #5
    Registered User
    Join Date
    12-09-2015
    Location
    Netherlands
    MS-Off Ver
    Office 2010 / 2013
    Posts
    9

    Re: Dots removed when data is send to sheet from userform.

    Hi Greg,

    thank you for getting back to me.

    I had a few more problems but with some help from a colleague I solved it. I couldn't set all the computers to the same settings, because all those computers use more than just this file. To avoid damage to the other programs, I used the following work-around.

    Public Sub ChangeSystemSeparators()
    
    Application.UseSystemSeparators = False
    Application.DecimalSeparator = "."
    Application.ThousandsSeparator = ","
    
    End Sub
    I basically declared the separators for the entire file in all relevant forms and sheets, so that it overrules the standard setting for the pc.
    Now, it uses dots in VBA, and comma's in the 'normal' worksheets. Then, i used this part of code to define all values that were transferred from the sheet to the userform.

    Private Sub tbNieuwV1_Change()
       If tbNieuwV1 = vbNullString Then
        Exit Sub
        Else
        tbNieuwV1 = Replace(tbNieuwV1, ",", ".")
        End If
    End Sub
    Also, i defined a few variables in the rest of the code, to force a certain formatting on them.

    Textbox.Value = Format(Textbox.Value("#####0.0###"))
    Now it all seems to work!

    - Edit: marked thread as solved -
    Last edited by Mathijs3; 02-02-2016 at 04:38 AM. Reason: Marked thread as solved.

  6. #6
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,516

    Re: Dots removed when data is send to sheet from userform.

    Hi again,

    Many thanks for that feedback - it´s always interesting and useful to receive follow-up information about a proposed solution.

    Best regards,

    Greg M

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Send Email using UserForm Data
    By Rosco88 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-07-2015, 10:51 AM
  2. Replies: 0
    Last Post: 02-27-2014, 04:43 PM
  3. [SOLVED] Send data of userform to a database
    By MariaPap in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-16-2013, 02:44 PM
  4. Data from one sheet isnt populating properly if certain valuse are removed
    By menor59 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-21-2013, 09:33 PM
  5. userform with 3 comboboxes and textboxes send to sheet
    By cfinch100 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-15-2013, 03:15 PM
  6. Send Userform data to selected row
    By revenge4ash89 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-10-2012, 05:09 AM
  7. [SOLVED] Excel 2003 / Send To / Mail Recipient / body text is removed
    By jmaynard2 in forum Excel General
    Replies: 1
    Last Post: 03-15-2005, 11:06 PM

Tags for this Thread

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