Help me!!

tomistuck

New Member
Joined
Feb 24, 2005
Messages
18
Hey I am doing excel work for school and im stuck. Well stuck is not even a word to describe how stuck I am.

as you can see on the spreadsheet(attached, the password is ign) when you click "add customer" it brings up a userform with some fields to fill in, what I need to do is somehow make it so when you fill in these fields and click done they fill into the right fields on the sheet "customerlist".(eg name goes in to name)

Is there any possible way to do this, or am I all out of luck?

here is a link to the spreadsheet.

http://www.warcraftunlimited.com/invoicemarinertravel.xls

thank you.
( i think its clear from the two exclamation marks how stuck I am)
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Hi

paste the code onto form module
Change the control name for the Name to nm
better not use pre-asigned name.

Code:
Private Enum AddrsDetails
    nm = 1
    AddressLIne1 = 2
    AddressLIne2 = 3
    country = 5
    Town = 4
    postcode = 6
End Enum

Private Sub CommandButton1_Click()
Dim col As AddrsDetails, wsC As Worksheet, LastR As Long
Set wsC = Sheets("customerlist")
With wsC
    LastR = .Range("a65536").End(xlUp).Row + 1
    col = nm: .Cells(LastR, col) = Me.nm: Me.nm = ""
    col = AddressLIne1: .Cells(LastR, col) = Me.TextBox2: Me.TextBox2 = ""
    col = AddressLIne2: .Cells(LastR, col) = Me.TextBox3: Me.TextBox3 = ""
    col = country: .Cells(LastR, col) = Me.TextBox5: Me.TextBox5 = ""
    col = postcode: .Cells(LastR, col) = Me.TextBox6: Me.TextBox6 = ""
    col = Town: .Cells(LastR, col) = Me.TextBox4: Me.TextBox4 = ""
End With
End Sub

do the rest for yourself

rgds,
jindon
 
Upvote 0
tomistuck,

Did you really make the form for yourself?

if you don't have any idea of Module then how counld you write a code?

Study hard!!!

open VB editor and right click on the Userform1 icon in the project window
and select View Code then paste the code there

rest you must search for your self.
don't even try to think to ask What is Enum, what is Me.etc

That's your study.

rgds,
jindon
 
Upvote 0
Have you changed the control name for textbox Name to nm?

You shouldn't asign those names like Name, Address....

Read the first post from me carefully.

rgds,
jindon
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,251
Members
448,556
Latest member
peterhess2002

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