The below is my code.
When ufmAccount is shown, it no longer recognizes wsA. It returns a runtime error 91.
Why is this? I thought a public variable can be used throughout.
Thank you in advance.
When ufmAccount is shown, it no longer recognizes wsA. It returns a runtime error 91.
Why is this? I thought a public variable can be used throughout.
Thank you in advance.
Code:
Public wsA As Worksheet, wbA As WorkbookSub NewExpense()
Dim sExpDesc As String, sReplace As String, sAccName As String, wbA As Workbook, wsA As Worksheet, iNextRow As Integer
Set wbA = ActiveWorkbook
Set wsA = ActiveSheet
iNextRow = 30
Do
iNextRow = iNextRow + 1
Loop Until wsA.Cells(iNextRow, 1) = ""
sExpDesc = InputBox("Enter what the new expense is...", "New Expense")
wsA.Cells(iNextRow, 4) = sExpDesc
ufmAccount.txtNewExp.Value = sExpDesc
'ufmAccount.lbxAccount.AddItem
ufmAccount.Show
End Sub