Question:

Excel VBA Code Programming?

by  |  earlier

0 LIKES UnLike

hey guys, i have a calculator set up, a form has been set up using alt+f11, a text box has been set to be dynamic with one of the cells in the workbook, i wish to set up a label that will be dynamic with another cell in the workbook, that is, when the value in that cell changes, it is displayed automatically on the label, a formula cell, currently, i have to click the label to update it, how do i make it so that the label automatically updates as i type?

heres the code

Private Sub Label5_Click()

Label5 = Worksheets("Arch Templar").Cells(6, 5)

End Sub

the label works, the only problem i have is automating it

 Tags:

   Report

2 ANSWERS


  1. Assume your cell for inputting the value is A1 of Sheet1, the label on your userform is Label1. Put the following in the sheet1(sheet1) module of your workbook.

    Private Sub Worksheet_Change(ByVal Target As Range)

       entryCell = "A1" 'this is the cell for entering number to show on textbox

       If Not Intersect(Target, Range(entryCell)) Is Nothing And UserForm1.Visible = True Then

          UserForm1.Label1.Caption = Target.Value

       End If

    End Sub

    Also, you since you have to use the worksheet while the userform is load and show, you need to set the properties showmodal of userform1 to False.

    Please contact for more details


  2. AQuestionMark hit the answer you are looking for right on the money.  I even learned something regarding the ShowModal property.  I have to say, AQuestionMark knows their stuff.

Question Stats

Latest activity: earlier.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.