LordDragon
10-30-2015, 08:42 PM
Greetings,
I'm stuck on a Boolean setting.
I know I can set a Boolean Variable that the whole workbook can use and set it to either True or False to start, then let it change as needed.
However, I need it to remember the setting even if the workbook is closed and reopened.
So, I'm trying to set the value of my Boolean variable in a specific cell.
I am using the following code to do that.
Function SetPreviewOrderRun()
Dim PreviewOrderRunControl As Boolean
PreviewOrderRunControl = ActiveWorkbook.Worksheets("Rig Survey Form").Range("AG14")
PreviewOrderRunControl = True
End Function
The problem seems to be in that code as when I manually change the targeted cell to True, then the following code works fine.
Private Sub CirronetRadioCheck()
Dim PreviewOrderRunControl As Boolean
PreviewOrderRunControl = ActiveWorkbook.Worksheets("Rig Survey Form").Range("AG14")
If PreviewOrderRunControl = False Then
Call CirronetRadioIncrement
Call SetPreviewOrderRun
Else
Exit Sub
End If
End Sub
I have tried putting the SetPreviewOrderRun code in a Sub and in various places and to have it called from different places.
The rest of the code is:
Function CirronetRadioIncrement()
Dim CommCableAdd As Integer
Dim CirronetRadioAdd As Integer
' Dim PreviewOrderRunControl As Boolean
CommCableAdd = ActiveWorkbook.Worksheets("EDR").Range("D56").Value
CirronetRadioAdd = ActiveWorkbook.Worksheets("EDR").Range("D8").Value
' PreviewOrderRunControl = ActiveWorkbook.Worksheets("Rig Survey Form").Range("AG14")
' Call SetPreviewOrderRun
If ActiveWorkbook.Worksheets("EDR").Range("A8").Value = strYes Then
With ActiveWorkbook.Worksheets("EDR")
.Range("A56").Value = strYes
.Range("D56").Value = CommCableAdd + 1
.Range("D8").Value = CirronetRadioAdd + 1
End With
' PreviewOrderRunControl = True
End If
End Function
As you can see, I've tried several different ways to get the code to set the assigned cell to True or Fale.
By the way, the following code works too:
Function ResetPreviewOrderRun()
Dim PreviewOrderRunControl As Boolean
PreviewOrderRunControl = ActiveWorkbook.Worksheets("Rig Survey Form").Range("AG14")
If PreviewOrderRunControl = True Then
ActiveWorkbook.Worksheets("Rig Survey Form").Range("AG14").Value = False
Else
Exit Function
End If
End Function
I would appreciate some help please.
I'm stuck on a Boolean setting.
I know I can set a Boolean Variable that the whole workbook can use and set it to either True or False to start, then let it change as needed.
However, I need it to remember the setting even if the workbook is closed and reopened.
So, I'm trying to set the value of my Boolean variable in a specific cell.
I am using the following code to do that.
Function SetPreviewOrderRun()
Dim PreviewOrderRunControl As Boolean
PreviewOrderRunControl = ActiveWorkbook.Worksheets("Rig Survey Form").Range("AG14")
PreviewOrderRunControl = True
End Function
The problem seems to be in that code as when I manually change the targeted cell to True, then the following code works fine.
Private Sub CirronetRadioCheck()
Dim PreviewOrderRunControl As Boolean
PreviewOrderRunControl = ActiveWorkbook.Worksheets("Rig Survey Form").Range("AG14")
If PreviewOrderRunControl = False Then
Call CirronetRadioIncrement
Call SetPreviewOrderRun
Else
Exit Sub
End If
End Sub
I have tried putting the SetPreviewOrderRun code in a Sub and in various places and to have it called from different places.
The rest of the code is:
Function CirronetRadioIncrement()
Dim CommCableAdd As Integer
Dim CirronetRadioAdd As Integer
' Dim PreviewOrderRunControl As Boolean
CommCableAdd = ActiveWorkbook.Worksheets("EDR").Range("D56").Value
CirronetRadioAdd = ActiveWorkbook.Worksheets("EDR").Range("D8").Value
' PreviewOrderRunControl = ActiveWorkbook.Worksheets("Rig Survey Form").Range("AG14")
' Call SetPreviewOrderRun
If ActiveWorkbook.Worksheets("EDR").Range("A8").Value = strYes Then
With ActiveWorkbook.Worksheets("EDR")
.Range("A56").Value = strYes
.Range("D56").Value = CommCableAdd + 1
.Range("D8").Value = CirronetRadioAdd + 1
End With
' PreviewOrderRunControl = True
End If
End Function
As you can see, I've tried several different ways to get the code to set the assigned cell to True or Fale.
By the way, the following code works too:
Function ResetPreviewOrderRun()
Dim PreviewOrderRunControl As Boolean
PreviewOrderRunControl = ActiveWorkbook.Worksheets("Rig Survey Form").Range("AG14")
If PreviewOrderRunControl = True Then
ActiveWorkbook.Worksheets("Rig Survey Form").Range("AG14").Value = False
Else
Exit Function
End If
End Function
I would appreciate some help please.