I have a variable which changes every time the worksheet opens. I declare it as public so that it can be passed to a procedure.
![]()
Public APLastCol As Long Sub ... () ... Static nColorIndices As Variant ReDim nColorIndices(1 To APLastCol) ... End SubFor some reason I can't get the count of the columns into the public variable. The watch shows it as being "out of context" and then my procedure does not work properly.![]()
Private Sub Workbook_Open() With Sheets("AB") APLastCol = .Cells(1, Sheets("AB").Columns.Count).End(xlToLeft).Column End With End Sub
Any ideas?











LinkBack URL
About LinkBacks
Register To Reply
Bookmarks