Userform Question

Jammydan

Board Regular
Joined
Feb 15, 2010
Messages
141
Hi

I have a simple userfrom which completes an account number(in 3 parts e.g 01/0000/01 with option of filling in 3 accounts.

My problem is if I only complete 1 account such as 01/00000/01 and then close the userform, it only enters 01/0000 and not the last 2 digits?

Code:
Private Sub OKButton_Click()
 
Application.ScreenUpdating = False
'****CASH ACCOUNTS****
    If TextBox1.Text <> "" Then Range("B17").End(xlDown).Offset(0, 35).Select
            Selection = TextBox1.Text
    If TextBox2.Text <> "" Then Range("B17").End(xlDown).Offset(0, 36).Select
            Selection = TextBox2.Text
    If TextBox3.Text <> "" Then Range("B17").End(xlDown).Offset(0, 37).Select
            Selection = TextBox3.Text
    If TextBox4.Text <> "" Then Range("B17").End(xlDown).Offset(0, 42).Select
            Selection = TextBox4.Text
    If TextBox5.Text <> "" Then Range("B17").End(xlDown).Offset(0, 43).Select
            Selection = TextBox5.Text
    If TextBox6.Text <> "" Then Range("B17").End(xlDown).Offset(0, 44).Select
            Selection = TextBox6.Text
    If TextBox7.Text <> "" Then Range("B17").End(xlDown).Offset(0, 49).Select
            Selection = TextBox7.Text
    If TextBox8.Text <> "" Then Range("B17").End(xlDown).Offset(0, 50).Select
            Selection = TextBox8.Text
    If TextBox9.Text <> "" Then Range("B17").End(xlDown).Offset(0, 51).Select
            Selection = TextBox9.Text
Unload UserFormAdditional
    Range("B17").End(xlDown).Select
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Forum statistics

Threads
1,224,587
Messages
6,179,734
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top