Trying to create a budgeting spreadsheet where expenditure is read in from a csv file, I get to allocate it to categories (via a user form) and for this bit, incoming funds get a separate userform where I can put a short description in a text box which then gets recorded next to the value in the output sheet.
Used this site loads to work out how to do it all - but stuck here.
macro works well, but drops out at the user form code with "Wrong number of arguments or invalid property assignment" and highlights the indescript(x) bit from the expend.Caption line.
Original sub is
Public x, xmax As Integer
Public incmng(1 To 100) As Variant
Public incdescript(1 To 100), inctot As String
' add in the incoming payments with user entered short description
inctot = ""
For x = 1 To xmax
indes.Show
inctot = incdescript(x) & "; " & inctot
Cells(r - 2, 7) = inctot
Next x
the user form (named indes) code is
Private Sub UserForm_Initialize()
' Load the expenditure details
expend.Caption = incdescript(x) & ": " & incmng(x)
incans.Value = "change me :-)"
End Sub
Private Sub OKButton_Click()
' Allow user to put in a short description
incdescript(x) = incmng(x) & " " & incans.Text
Unload Me
End Sub
Private Sub CancelButton_Click()
Unload Me
End
End Sub
It's almost as if it can't transport the values for "x" between the subs, as in the former it is showing as value = 1 in watch, in the userform code it shows as unable to compile.
thanks for any advice!