Hi willingfull reader,
I thought I had it figured it out to format my dates into my worksheets with this code
This formatting works fine if all the textboxes are filled out, but not always is all the date info available, so it is left blank when other data is filled out into my userform.
When this happens I get an error 13 mismatch. I have been reading up about this, but since I am a newbie I couldn't figure it out, only that it could have something to do with my variables.
I found that strange since when I used just 1 variable say Dim bd as Date and omitted the format for the other textboxes it worked fine.
So I tried it with OR statement
Which didn't work because I got the same error 13 back.
I tried with Elseif statements also to no avail either.
If anyone could help me out with this problem, I would be eternally gratefull
I thought I had it figured it out to format my dates into my worksheets with this code
VBA Code:
Dim bd As Date
Dim ld As Date
Dim dd As Date
Dim de As Date
bd = tbDob.Text
ld = tbLastDive.Text
dd = tbDep_date.Text
de = tbDisembark_date.Text
tbDob.Text = Format(bd, "D.MM.YYYY")
'some insert code here for worksheet 1
tbLastDive.Text = Format(ld, "MMM.YYYY")
'some insert code here for worksheet 2
tbDep_date.Text = Format(dd, "D.MM.YYYY")
tbDisembark_date.Text = Format(de, "D.MM.YYYY")
'some insert code here for worksheet 2
When this happens I get an error 13 mismatch. I have been reading up about this, but since I am a newbie I couldn't figure it out, only that it could have something to do with my variables.
I found that strange since when I used just 1 variable say Dim bd as Date and omitted the format for the other textboxes it worked fine.
So I tried it with OR statement
VBA Code:
If tbDob.Text = "" Or tbLastDive.Text = "" Or tbDep_date.Text = "" Or tbDisembark_date.Text = "" Then
'End If
I tried with Elseif statements also to no avail either.
If anyone could help me out with this problem, I would be eternally gratefull