Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 17
Default Adding data to existing data that has a unique number in column

Userform1 adds data to the database as such,
A B C D E F
G
1 PICKID NAME START FINISH PICKS DATE
2 5 TIM 1900
5-19-06
3 7 BILL 2000
5-19-06
4 8 JOE 1900
5-19-06
ETC.

I would like userform2 to add the finish time and picks to the database
that corresponds with the appropriate pickid . the forms are already made
and i've used a combobox in form2 for the pickid , txtbox for finish , txtbox
for picks .
I use to forms because users click a start button wich opens form1 and the
data is entered as seen above, when finished with task they click finish
button wich will open form2 and add the finish time and picks to the database.

I would think this is possible , however finding myself confused on this.
thanks for any help offered.


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,339
Default Adding data to existing data that has a unique number in column

Use MATCH (pickID on Userform2 against the database) to get row number and
then assign Userform2 data to appropriate cells.

in VBA

row=APPLICATION.MATCH(pickid,Data!A:A,0)


pickid= Userform2 textbox for pickID
Data is you database sheet

HTH
"Lars" wrote:

Userform1 adds data to the database as such,
A B C D E F
G
1 PICKID NAME START FINISH PICKS DATE
2 5 TIM 1900
5-19-06
3 7 BILL 2000
5-19-06
4 8 JOE 1900
5-19-06
ETC.

I would like userform2 to add the finish time and picks to the database
that corresponds with the appropriate pickid . the forms are already made
and i've used a combobox in form2 for the pickid , txtbox for finish , txtbox
for picks .
I use to forms because users click a start button wich opens form1 and the
data is entered as seen above, when finished with task they click finish
button wich will open form2 and add the finish time and picks to the database.

I would think this is possible , however finding myself confused on this.
thanks for any help offered.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 17
Default Adding data to existing data that has a unique number in colum

Thank you for your help , being a beginner i appreciate the way you described
this, however i would greatly appreciate it if you could show me how to
incorperate it into this code


Private Sub CommandButton1_Click()
Dim Row As Long
Dim Part As Long
Dim ws As Worksheet
Set ws = Worksheets("PickData")

'find first empty row in database
Row = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

Part = Me.cboBox1.ListIndex

'check for a part number
If Trim(Me.cboBox1.Value) = "" Then
Me.cboBox1.SetFocus
MsgBox "Please enter a pick number"
Exit Sub
End If

'copy the data to the database
With ws
.Cells(Row, 4).Value = Me.TextBox3.Value
.Cells(Row, 5).Value = Me.TextBox4.Value

End With

'clear the data
Me.cboBox1.Value = ""
Me.TextBox3.Value = ""
Me.TextBox4.Value = ""
Me.cboBox1.SetFocus



End Sub


Private Sub UserForm_Initialize()
Dim cPart As Range
Dim ws As Worksheet
Set ws = Worksheets("PickerLists")

For Each cPart In ws.Range("IdentifyList")
With Me.cboBox1
.AddItem cPart.Value
.List(.ListCount - 1, 1) = cPart.Offset(0, 1).Value
End With
Next cPart



Me.TextBox3.Value = ""
Me.TextBox4.Value = ""
Me.cboBox1.SetFocus

End Sub


"Toppers" wrote:

Use MATCH (pickID on Userform2 against the database) to get row number and
then assign Userform2 data to appropriate cells.

in VBA

row=APPLICATION.MATCH(pickid,Data!A:A,0)


pickid= Userform2 textbox for pickID
Data is you database sheet

HTH
"Lars" wrote:

Userform1 adds data to the database as such,
A B C D E F
G
1 PICKID NAME START FINISH PICKS DATE
2 5 TIM 1900
5-19-06
3 7 BILL 2000
5-19-06
4 8 JOE 1900
5-19-06
ETC.

I would like userform2 to add the finish time and picks to the database
that corresponds with the appropriate pickid . the forms are already made
and i've used a combobox in form2 for the pickid , txtbox for finish , txtbox
for picks .
I use to forms because users click a start button wich opens form1 and the
data is entered as seen above, when finished with task they click finish
button wich will open form2 and add the finish time and picks to the database.

I would think this is possible , however finding myself confused on this.
thanks for any help offered.


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,339
Default Adding data to existing data that has a unique number in colum

Be easier if you sent me a w/book with Userforms etc.


toppers <at NOSPAMjohntopley.fsnet.co.uk

remove NOSPAM from e-mail address.

"Lars" wrote:

Thank you for your help , being a beginner i appreciate the way you described
this, however i would greatly appreciate it if you could show me how to
incorperate it into this code


Private Sub CommandButton1_Click()
Dim Row As Long
Dim Part As Long
Dim ws As Worksheet
Set ws = Worksheets("PickData")

'find first empty row in database
Row = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

Part = Me.cboBox1.ListIndex

'check for a part number
If Trim(Me.cboBox1.Value) = "" Then
Me.cboBox1.SetFocus
MsgBox "Please enter a pick number"
Exit Sub
End If

'copy the data to the database
With ws
.Cells(Row, 4).Value = Me.TextBox3.Value
.Cells(Row, 5).Value = Me.TextBox4.Value

End With

'clear the data
Me.cboBox1.Value = ""
Me.TextBox3.Value = ""
Me.TextBox4.Value = ""
Me.cboBox1.SetFocus



End Sub


Private Sub UserForm_Initialize()
Dim cPart As Range
Dim ws As Worksheet
Set ws = Worksheets("PickerLists")

For Each cPart In ws.Range("IdentifyList")
With Me.cboBox1
.AddItem cPart.Value
.List(.ListCount - 1, 1) = cPart.Offset(0, 1).Value
End With
Next cPart



Me.TextBox3.Value = ""
Me.TextBox4.Value = ""
Me.cboBox1.SetFocus

End Sub


"Toppers" wrote:

Use MATCH (pickID on Userform2 against the database) to get row number and
then assign Userform2 data to appropriate cells.

in VBA

row=APPLICATION.MATCH(pickid,Data!A:A,0)


pickid= Userform2 textbox for pickID
Data is you database sheet

HTH
"Lars" wrote:

Userform1 adds data to the database as such,
A B C D E F
G
1 PICKID NAME START FINISH PICKS DATE
2 5 TIM 1900
5-19-06
3 7 BILL 2000
5-19-06
4 8 JOE 1900
5-19-06
ETC.

I would like userform2 to add the finish time and picks to the database
that corresponds with the appropriate pickid . the forms are already made
and i've used a combobox in form2 for the pickid , txtbox for finish , txtbox
for picks .
I use to forms because users click a start button wich opens form1 and the
data is entered as seen above, when finished with task they click finish
button wich will open form2 and add the finish time and picks to the database.

I would think this is possible , however finding myself confused on this.
thanks for any help offered.


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
adding data to existing data cell Curious Excel Worksheet Functions 2 January 19th 07 08:21 PM
Adding new data to existing data kekule Excel Worksheet Functions 1 March 3rd 06 06:58 PM
Copying Data into Column with Existing Data GZul Excel Discussion (Misc queries) 0 February 9th 06 11:30 PM
Adding more source data to existing scatter plot Tom Charts and Charting in Excel 1 March 21st 05 10:03 PM
find rows for unique data in 1 column and different data in other. Dot Majewski Excel Discussion (Misc queries) 1 January 21st 05 12:23 AM


All times are GMT +1. The time now is 05:13 PM.

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

About Us

"It's about Microsoft Excel"