Skip to main content
  1. About
  2. For Teams
Asked
Viewed 823 times
1

I have a userform where I want to display data from a spreadsheet. The spread sheet is an input interface and the calculations will be displayed on my useform. My problem is to fetch the data. I have tried the code below, but what hapeens is that te correct data only appears if the user clicks on the label from the form. I need it to automatically load when i load the form. Where am I going wrong?

Private Sub Label3_Click()

Label3.Caption = Sheets("mysource").Range("o3")

End Sub 

1 Answer 1

1

Try using:

Private Sub UserForm_Initialize()

    Label3.Caption = Sheets("mysource").Range("O3").Value

End Sub 
Sign up to request clarification or add additional context in comments.

3 Comments

Doesnt work. My problem is the "on click" command. I mean, when the form is loaded, it will show the data correctly IF i click on the label itself. Thats not what i want. I need it to open already showing the correct information.
user8753746
user8753746
Edited my answer. You should add that line in your UserForm Initialize event. Modify the name with your UserForm Name.
Thanks!! That's exactly it.

Your Answer

Post as a guest

Required, but never shown

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.