Home Schroedinger's label caption update
Reply: 0

Schroedinger's label caption update

user933 Published in July 18, 2018, 4:49 am

I have some code in VBA that goes like this:

Sub UserForm2_Activate()
If [statement] then  
  Label1.caption = x  
  Label2.caption = x*y  

When I activate the UserForm with these labels from the other one (using UserForm2.Show) the results are Label1 = x, Label2 = 0. But when I try "UserForm2.Show" from the Immediate window, everything works pretty good and I get the correct data.

What am I doing wrong?

The actual code:

If Sheets("SL").Range("B8").Value = True Then
   Label8.Caption = Find_cost(Sheets("SL").Range("b5").Value, Sheets("SL").Range("B4").Value, "ID")
   Label20.Caption = Find_cost(Sheets("SL").Range("b5").Value, Sheets("SL").Range("B4").Value, "ID") * Sheets("SL").Range("b4").Value
   Label8.Caption = "none"
   Label20.Caption = "none"
End If

Where "Find_cost" is a custom function

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.309878 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO