#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default User Form

I need user to interactively enter sales data into six non-contiguous columns
each of which is a named range i.e. Date, Quantity, Rate, Net Amount,
SalesTax, Service
Tax. The rest of the columns are calculated from this data and are locked.
Data is filled as each transaction takes place.

Afer entry user should review and confirm before data is saved. Can someone
please help! I had posted this earlier but no success so far. Someone did
say it can be done. But not how!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default User Form

Hi,

I don't know how far along the road you are in your goal but lets start from
scratch. Create a userform and put the textboxes and a command button on it.
Right click the command button and view code and paste the code below in.

You now have some (not a lot of) functionality. When the command button is
pressed the user is asked whether thay want to commit the data and if OK is
pressed the data in the 3 textboxes are written to the first empty cell in 3
columns.

There are still challenges for you. For example there may be nothing in the
textboxes or the data may be wrong and you need to write tests for this but I
hope this gets you moving along.

Private Sub CommandButton1_Click()
response = MsgBox("Are you sure you want to commit the data?", vbOKCancel)
If response = vbCancel Then GoTo getmeout

With Sheets("Sheet2")
lastrowC = .Cells(Rows.Count, "C").End(xlUp).Row
lastrowF = .Cells(Rows.Count, "F").End(xlUp).Row
lastrowG = .Cells(Rows.Count, "G").End(xlUp).Row
.Range("C" & lastrowC + 1).Value = TextBox1.Text
.Range("F" & lastrowF + 1).Value = TextBox2.Text
.Range("G" & lastrowG + 1).Value = TextBox3.Text
End With
getmeout:
Unload Me
End Sub



Mike


"a m spock" wrote:

I need user to interactively enter sales data into six non-contiguous columns
each of which is a named range i.e. Date, Quantity, Rate, Net Amount,
SalesTax, Service
Tax. The rest of the columns are calculated from this data and are locked.
Data is filled as each transaction takes place.

Afer entry user should review and confirm before data is saved. Can someone
please help! I had posted this earlier but no success so far. Someone did
say it can be done. But not how!!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default User Form

Hi,

I should have added that my example is for three textboxes only but it
should be fairly intuative what you need to do to increase this to the six
you require.


Mike

"Mike H" wrote:

Hi,

I don't know how far along the road you are in your goal but lets start from
scratch. Create a userform and put the textboxes and a command button on it.
Right click the command button and view code and paste the code below in.

You now have some (not a lot of) functionality. When the command button is
pressed the user is asked whether thay want to commit the data and if OK is
pressed the data in the 3 textboxes are written to the first empty cell in 3
columns.

There are still challenges for you. For example there may be nothing in the
textboxes or the data may be wrong and you need to write tests for this but I
hope this gets you moving along.

Private Sub CommandButton1_Click()
response = MsgBox("Are you sure you want to commit the data?", vbOKCancel)
If response = vbCancel Then GoTo getmeout

With Sheets("Sheet2")
lastrowC = .Cells(Rows.Count, "C").End(xlUp).Row
lastrowF = .Cells(Rows.Count, "F").End(xlUp).Row
lastrowG = .Cells(Rows.Count, "G").End(xlUp).Row
.Range("C" & lastrowC + 1).Value = TextBox1.Text
.Range("F" & lastrowF + 1).Value = TextBox2.Text
.Range("G" & lastrowG + 1).Value = TextBox3.Text
End With
getmeout:
Unload Me
End Sub



Mike


"a m spock" wrote:

I need user to interactively enter sales data into six non-contiguous columns
each of which is a named range i.e. Date, Quantity, Rate, Net Amount,
SalesTax, Service
Tax. The rest of the columns are calculated from this data and are locked.
Data is filled as each transaction takes place.

Afer entry user should review and confirm before data is saved. Can someone
please help! I had posted this earlier but no success so far. Someone did
say it can be done. But not how!!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default User Form

mike

many thanks. i am afraid i have no idea how to create a userform. so i am i
don't know many steps behind where you start. can you help an ignorant novice?

spock

"Mike H" wrote:

Hi,

I should have added that my example is for three textboxes only but it
should be fairly intuative what you need to do to increase this to the six
you require.


Mike

"Mike H" wrote:

Hi,

I don't know how far along the road you are in your goal but lets start from
scratch. Create a userform and put the textboxes and a command button on it.
Right click the command button and view code and paste the code below in.

You now have some (not a lot of) functionality. When the command button is
pressed the user is asked whether thay want to commit the data and if OK is
pressed the data in the 3 textboxes are written to the first empty cell in 3
columns.

There are still challenges for you. For example there may be nothing in the
textboxes or the data may be wrong and you need to write tests for this but I
hope this gets you moving along.

Private Sub CommandButton1_Click()
response = MsgBox("Are you sure you want to commit the data?", vbOKCancel)
If response = vbCancel Then GoTo getmeout

With Sheets("Sheet2")
lastrowC = .Cells(Rows.Count, "C").End(xlUp).Row
lastrowF = .Cells(Rows.Count, "F").End(xlUp).Row
lastrowG = .Cells(Rows.Count, "G").End(xlUp).Row
.Range("C" & lastrowC + 1).Value = TextBox1.Text
.Range("F" & lastrowF + 1).Value = TextBox2.Text
.Range("G" & lastrowG + 1).Value = TextBox3.Text
End With
getmeout:
Unload Me
End Sub



Mike


"a m spock" wrote:

I need user to interactively enter sales data into six non-contiguous columns
each of which is a named range i.e. Date, Quantity, Rate, Net Amount,
SalesTax, Service
Tax. The rest of the columns are calculated from this data and are locked.
Data is filled as each transaction takes place.

Afer entry user should review and confirm before data is saved. Can someone
please help! I had posted this earlier but no success so far. Someone did
say it can be done. But not how!!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date field in user form & Loading a user form on opening workbook Balan Excel Programming 1 May 24th 08 03:40 PM
Call user form from ThisWorkbook; close file if form closed XP Excel Programming 2 July 20th 07 07:04 PM
Automatically add a textbox to a user form based on user requireme Brite Excel Programming 4 April 7th 07 11:37 PM
User form ComboBox Items: Remember user entries? [email protected] Excel Programming 0 March 29th 07 06:41 PM
How to: User Form to assign a user defined range to a macro variab TrevTrav Excel Programming 1 March 22nd 05 07:57 PM


All times are GMT +1. The time now is 09:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"