Code:
Public NumRows As Long
Code:
Private Sub Workbook_Open()
NumRows = Worksheets("TableSize").Range("A1").Value
MsgBox "NumRows = " & NumRows
End Sub
Sheet TableSize only has information in A1.
Code:
Private Sub Worksheet_Calculate()
Dim n As Long
n = Worksheets("TableSize").Range("A1").Value [B][COLOR=#008000]'A1 contains the formula "=ROW(INDEX(Sheet1,1,1))+ROWS(Sheet1)-1" used to count rows on Sheet 1[/COLOR][/B]
MsgBox n & "NumRows=" & NumRows [B][COLOR=#ff0000]'For some reason NumRows returns 0 here when it returns 32 above. n returns 32 like it should[/COLOR][/B]
If n = NumRows Then Exit Sub
If n > NumRows Then Call NewDatabaseEntry
NumRows = n
End Sub
Am I missing something crucial?