I have created an Excel Spreadsheet to categorize expenses that show on my downloaded bank statement.
Occasionally a sum has to be split into 2 or 3 categories and I have a user form with 3 text boxes and 3 combo boxes where I can enter the split details. (amounts and categories).
Before this data is transferred to the spreadsheet a check is carried out to ensure the sum of the split amounts equals the original amount.
The variable holding the original amount is called startvalue and the error message is contained in another userform called SplitDoesntAddUp
The code for the check is...
If StartValue <> (Val(TextBox4.Text) + Val(TextBox5.Text) + Val(TextBox6.Text)) Then
SplitDoesntAddUp.Show
Exit Sub
This has always worked perfectly except...today I had an expense of 241.08 that I split as 200 + 41.08 and this threw up the error message.
If I split it as 200.01+41.07...also error
If I split it as 199.99+41.09 ...no error
If I split it as 200.02+ 41.06...no error
If I split it as 200+40+1.08...no error
I have subsequently created a message box that shows (Val(TextBox4.Text) + Val(TextBox5.Text) + Val(TextBox6.Text)) before running the check code as shown above.
When I split the amount as 200+41.08 or 200.01+41.07 the message box returns 241.08 but still shows the error message on the next step.
The split code is still working normally for other items on my bank statement
I have closed Excel and reopened it but the conundrum remains.
Does anyone have any ideas of what I should be looking for that might be creating this error?
Occasionally a sum has to be split into 2 or 3 categories and I have a user form with 3 text boxes and 3 combo boxes where I can enter the split details. (amounts and categories).
Before this data is transferred to the spreadsheet a check is carried out to ensure the sum of the split amounts equals the original amount.
The variable holding the original amount is called startvalue and the error message is contained in another userform called SplitDoesntAddUp
The code for the check is...
If StartValue <> (Val(TextBox4.Text) + Val(TextBox5.Text) + Val(TextBox6.Text)) Then
SplitDoesntAddUp.Show
Exit Sub
This has always worked perfectly except...today I had an expense of 241.08 that I split as 200 + 41.08 and this threw up the error message.
If I split it as 200.01+41.07...also error
If I split it as 199.99+41.09 ...no error
If I split it as 200.02+ 41.06...no error
If I split it as 200+40+1.08...no error
I have subsequently created a message box that shows (Val(TextBox4.Text) + Val(TextBox5.Text) + Val(TextBox6.Text)) before running the check code as shown above.
When I split the amount as 200+41.08 or 200.01+41.07 the message box returns 241.08 but still shows the error message on the next step.
The split code is still working normally for other items on my bank statement
I have closed Excel and reopened it but the conundrum remains.
Does anyone have any ideas of what I should be looking for that might be creating this error?