VBA use global variable in userform code
问题 I'm working in Excel 2010 VBA. Is there a way of accessing values in global variables declared outside a userform, in code inside the userform? Code inside my userform returns the global variable as null - can't work out why! The variable is declared in the ThisWorkbook module as: Public TargetCell As Range Public TargetCellWorksheet as Worksheet Public CurrentValue As Long Inside the userform, I have this code on the "Update" button: Private Sub Update_Click() MsgBox ("Start of Update sub.