Hello,
I would like that when my spread sheet opens, I set a constant global variable so that when the rest of the VBA code runs, it can access it from anywhere
Here below is in the "ThisWorkbook" file whcih should execute right awaya as the excel file opens
![]()
Public NoOfParts As Integer Sub setup() Dim PARTS As Integer PARTS = 9 NoOfParts = PARTS - 1 End Sub
And here is some VBA code I execute via a button which should see the "NoOfParts" variable. But it doesn't????
![]()
Sub ClrFilter() Dim unmergeTheCells As Integer Dim MyStr As String unmergeTheCells = ((NoOfParts + 1) * 5) + 5 ' <<<<<<< NoOfParts is EMPTY????? MyStr = "" & "B6" & ":E" & CStr(unmergeTheCells) & "" ' ....
Bookmarks