Rode Peters
New Member
- Joined
- Mar 6, 2024
- Messages
- 1
- Office Version
- 365
- Platform
- Windows
- MacOS
I'm using this section of code to call the variables lowOut And upOut from a user form, but can't seem to get it to cooperate.
VBA Code:
' ThisWorkbook Module
'this code runs first
sub ProccesData()
~~~some other variable~~~
Dim lowOut As Double
Dim upOut As Double
Load ChartRange
ChartRange.Show vbModal
MsgBox "lowOut: " & lowOut & vbNewLine & "upOut: " & upOut
Unload ChartRange
~~~rest of code~~~
EndSub
'uf code
Private Sub generatePlotButton_Click()
Dim lowIn As Double
Dim upIn As Double
Dim lowU As String
Dim upU As String
lowIn = ChartRange.lowBndTextBox.value
upIn = ChartRange.upBndTextBox.value
lowU = ChartRange.lowBndComboBox.value
upU = ChartRange.upBndComboBox.value
If ((Len(Trim(lowU)) <> 0) Or (Len(Trim(lowU)) <> 0)) Then
MsgBox "Ploting bound value(s) missing, your doing great bud. give it another try"
GoTo NextStep
End If
If StrComp(lowU, "MHz", vbTextCompare) = 0 Then
lowOut = lowIn * 100000
ElseIf StrComp(lowU, "GHz", vbTextCompare) = 0 Then
lowOut = lowIn * 1000000
Else
MsgBox "unacceptable lower unit entered, good try bud"
GoTo NextStep
End If
If StrComp(upU, "MHz", vbTextCompare) = 0 Then
upOut = upIn * 100000
ElseIf StrComp(upU, "GHz", vbTextCompare) = 0 Then
upOut = upIn * 1000000
Else
MsgBox "unacceptable upper unit entered, good try bud"
GoTo NextStep
End If
If lowOut >= upOut Then
MsgBox "Lower bound greater than upper bound, try again buddy"
GoTo NextStep
Else
MsgBox "plotting data from " & lowOut & " Hz to " & upOut & " Hz"
Unload ChartRange
End If
NextStep:
ChartRange.Hide
End Sub
Last edited by a moderator: