+ Reply to Thread
Results 1 to 4 of 4

Refresh Label in Userform Vba

  1. #1
    Registered User
    Join Date
    05-06-2012
    Location
    Lisbon,Portugal
    MS-Off Ver
    Excel 2010
    Posts
    79

    Refresh Label in Userform Vba

    hi everyone
    I have a userform with combobox, textbox, CommanButton( to add data in worksheet) and two Labels. One of these is changed with the value of the cell in worksheet.
    how can I do a label change according the value of the cell in worksheet, without log out of the userform?Its a problem with refresh values that I need to know.
    My code is:xx
    My code:
    Private Sub UserForm_Initialize()
    Dim tt As Double

    Label1.Caption = tt
    tt = WorksheetFunction.Sum(Sheets("ws-vba").Range("A2"))
    Label1.Caption = Format(tt, "#.00 €")

    If Label1.Caption <> "" Then
    Label2.Caption = "DUOD"

    End If


    Private Sub CmdAdd_click()
    If WorksheetFunction.Sum(Sheets("ws-vba").Range("A2")) = 0 Then
    Label1.Caption = ""
    Label2.Caption = ""
    Else
    WorksheetFunction.Sum (Sheets("ws-vba").Range("A2"))

    End If
    End sub


    Thanks advence

  2. #2
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Refresh Label in Userform Vba

    this might be what you are after

    Please Login or Register  to view this content.
    Regards
    Sean

    Please add to my reputation if you think i helped
    (click on the star below the post)
    Mark threads as "Solved" if you have your answer
    (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code:
    [code] Your code here [code]
    Please supply a workbook containing example Data:
    It makes its easier to answer your problem & saves time!

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Refresh Label in Userform Vba

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code in [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Registered User
    Join Date
    05-06-2012
    Location
    Lisbon,Portugal
    MS-Off Ver
    Excel 2010
    Posts
    79

    Re: Refresh Label in Userform Vba

    Please Login or Register  to view this content.

+ Reply to Thread

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