Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Populating worksheet from userform combobox


I'm having problems trying to get the selected item in the combobox t
populate the existing row in the worksheet. When I click on th
selected item in the combobox and save to the worksheet it adds th
item to the next empty row instead of using the existing row, creatin
a duplicate item entry. What I would like to happen is if the ite
already exists in the combobox, then add rest of the userform data t
that existing row on the worksheet. If a new item is entered in th
combobox, then the userform data would be entered in the next availabl
empty row

--
buckcho
-----------------------------------------------------------------------
buckchow's Profile: http://www.officehelp.in/member.php?userid=597
View this thread: http://www.officehelp.in/showthread.php?t=131886

Posted from - http://www.officehelp.i

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Populating worksheet from userform combobox

Hi Buckchow,

Please can you post your code so that somebody could provide could help me.

--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"buckchow" wrote:


I'm having problems trying to get the selected item in the combobox to
populate the existing row in the worksheet. When I click on the
selected item in the combobox and save to the worksheet it adds the
item to the next empty row instead of using the existing row, creating
a duplicate item entry. What I would like to happen is if the item
already exists in the combobox, then add rest of the userform data to
that existing row on the worksheet. If a new item is entered in the
combobox, then the userform data would be entered in the next available
empty row.


--
buckchow
------------------------------------------------------------------------
buckchow's Profile: http://www.officehelp.in/member.php?userid=5975
View this thread: http://www.officehelp.in/showthread.php?t=1318864

Posted from - http://www.officehelp.in


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Populating worksheet from userform combobox


Listed below is the code I'm having a problem with:


Private Sub UserForm_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Data")
txtBatch1.SetFocus
'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

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

'copy the data to the database
ws.Cells(iRow, 1).Value = Me.txtBatch1.Value
ws.Cells(iRow, 2).Value = Me.txtDate1.Value
ws.Cells(iRow, 3).Value = Me.txtCust1.Value
ws.Cells(iRow, 4).Value = Me.txtBoard1.Value
ws.Cells(iRow, 5).Value = Me.txtSerial1.Value
ws.Cells(iRow, 6).Value = Me.txtQty1.Value
ws.Cells(iRow, 18).Value = Me.txtStatus1.Value
ws.Cells(iRow, 17).Value = Me.txtNotes.Value

'clear the data
Me.txtBatch1.Value = ""
Me.txtDate1.Value = ""
Me.txtCust1.Value = ""
Me.txtBoard1.Value = ""
Me.txtSerial1.Value = ""
Me.txtQty1.Value = ""
Me.txtStatus1.Value = ""
Me.txtNotes.Value = ""
Me.txtBatch1.SetFocus

End Su

--
buckcho
-----------------------------------------------------------------------
buckchow's Profile: http://www.officehelp.in/member.php?userid=597
View this thread: http://www.officehelp.in/showthread.php?t=131886

Posted from - http://www.officehelp.i

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
Populating a ComboBox in a UserForm I Maycotte[_5_] Excel Programming 2 June 27th 06 06:28 PM
Populating Userform ComboBox with worksheet names in XL2003 MAWII Excel Programming 0 August 9th 05 09:07 PM
Populating a ComboBox DirInfo Excel Programming 1 March 17th 05 10:03 PM
populating a combobox on a worksheet Tim Marsh[_2_] Excel Programming 2 November 3rd 03 12:44 PM


All times are GMT +1. The time now is 09:03 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"