Great that was the thing i was looking for!
Variable(1)
Variable(2)
So i can choose the result.
Then i donīt need to separate Variables either!
Sadly, i am at another problem now thanks to my lack of knowledge.
Public Sub UserForm_initialize()
Dim rng1x As Range
Dim rng1y As Range
Dim rng2x As Range
Dim rng2y As Range
Dim rng3x As Range
Dim rng3y As Range
Dim v1 As Variant, v2 As Variant, v3 As Variant
Set rng1x = Range("A2", Range("A2").End(xlDown))
Set rng1y = Range("C2", Range("C2").End(xlDown))
Set rng2x = Range("G2", Range("G2").End(xlDown))
Set rng2y = Range("H2", Range("H2").End(xlDown))
Set rng3x = Range("A2", Range("A2").End(xlDown))
Set rng3y = Range("B2", Range("B2").End(xlDown))
With WorksheetFunction
v1 = .LinEst(rng1y, rng1x)
v2 = .LinEst(rng2y, rng2x)
v3 = .LinEst(rng3y, rng3x)
FPS1 = (1000 / 12) / (10000000 / 333333)
FPS2 = (1000 / Cells(11, 11)) * (10000000 / 333333)
FPS3 = Cells(12, 13) * 48000
End With
fps = 10000000 / 333333
fpsu = FPS1 * fps
bit = 2
s = 48000
Label1.Caption = "Correct Factor " & Cells(15, 11)
TextBox4.Value = v1(2) - v2(2)
TextBox6.Value = v1(2)
TextBox7.Value = v2(2)
ReadData
End Sub
Public Sub ReadData()
FPS1 = (1000 / Cells(11, 11)) / (10000000 / 333333)
FPS2 = (1000 / Cells(11, 11)) * (10000000 / 333333)
FPS3 = v1(1) * 48000
Here is an example from my code, i dinīt copy everything as it didnīt matter.
But if if you look at the other sub (ReadData), i am trying to use the v1 variable from the other (UserForm_initialize) sub.
But it doesnīt work, i guess you canīt get the other variables from other subs just like that.
I currently have done some very bad shortcuts to solved this, but it has worked.
But now i canīt do anything, so i would like to know what i am supposed to do to let it use the variable.
Thanks
Bookmarks