#1
|
|||
|
|||
Excel List Box not populating worksheet field upon submit
I have two forms I have created using MS Visual Basic for Applications within MS Excel 2013.
Both forms are populate all the non-list fields in the correct worksheet fields (columns); however, none of the list based form fields are populating upon submit. During the form fill out, the list boxes show the correct list items based upon the Named Range in the workbook. Here is the code for one of the forms (Change Log): Private Sub CommandButton1_Click() End Sub Private Sub entry_Tool_Click() End Sub Private Sub formCLOSE_Click() Unload Me End Sub Private Sub formSUBMIT_Click() Dim iRow As Long Dim ws As Worksheet Set ws = Worksheets("Change Log") 'find first empty row in database iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _ SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1 'check for a request number If Trim(Me.entry_ITQ.Value) = "" Then Me.entry_ITQ.SetFocus MsgBox "Please enter a request number" Exit Sub End If 'copy the data to the database 'use protect and unprotect lines, ' with your password ' if worksheet is protected With ws ' .Unprotect Password:="password" .Cells(iRow, 2).Value = Me.entry_ITQ.Value .Cells(iRow, 3).Value = Me.entry_Category.Value .Cells(iRow, 4).Value = Me.entry_RequestType.Value .Cells(iRow, 5).Value = Me.entry_Project.Value .Cells(iRow, 6).Value = Me.entry_Tool.Value .Cells(iRow, 7).Value = Me.entry_Description.Value .Cells(iRow, 8).Value = Me.entry_RequestStatus.Value .Cells(iRow, 9).Value = Me.entry_ChangePhase.Value .Cells(iRow, 11).Value = Me.entry_Requestor.Value .Cells(iRow, 12).Value = Me.entry_Assigned.Value .Cells(iRow, 13).Value = Me.entry_Priority.Value .Cells(iRow, 14).Value = Me.entry_Impact.Value .Cells(iRow, 15).Value = Me.entry_RequestDate.Value .Cells(iRow, 17).Value = Me.entry_ApprovedDate.Value .Cells(iRow, 19).Value = Me.entry_StartDate.Value .Cells(iRow, 20).Value = Me.entry_TargetDate.Value .Cells(iRow, 21).Value = Me.entry_CompletionDate.Value .Cells(iRow, 22).Value = Me.entry_Notes.Value ' .Protect Password:="password" End With 'clear the data Me.entry_ITQ.Value = "" Me.entry_Category.Value = "" Me.entry_RequestType.Value = "" Me.entry_Project.Value = "" Me.entry_Tool.Value = "" Me.entry_Description.Value = "" Me.entry_RequestStatus.Value = "" Me.entry_ChangePhase.Value = "" Me.entry_Requestor.Value = "" Me.entry_Assigned.Value = "" Me.entry_Priority.Value = "" Me.entry_Impact.Value = "" Me.entry_RequestDate.Value = "" Me.entry_ApprovedDate.Value = "" Me.entry_StartDate.Value = "" Me.entry_TargetDate.Value = "" Me.entry_CompletionDate.Value = "" Me.entry_Notes.Value = "" End Sub Option Explicit Private Sub UserForm_Initialize() Dim cCategory As Range Dim cProject As Range Dim cTool As Range Dim cStatus As Range Dim cPhase As Range Dim cPriority As Range Dim cImpact As Range Dim ws As Worksheet Set ws = Worksheets("Drop-down") For Each cCategory In ws.Range("Category") With Me.entry_Category .AddItem cCategory.Value End With Next cCategory For Each cProject In ws.Range("project") With Me.entry_Project .AddItem cProject.Value End With Next cProject For Each cTool In ws.Range("Tech_Tool") With Me.entry_Tool .AddItem cTool.Value End With Next cTool For Each cStatus In ws.Range("item_status") With Me.entry_RequestStatus .AddItem cStatus.Value End With Next cStatus For Each cPhase In ws.Range("phase_status") With Me.entry_ChangePhase .AddItem cPhase.Value End With Next cPhase For Each cPriority In ws.Range("priority") With Me.entry_Priority .AddItem cPriority.Value End With Next cPriority For Each cImpact In ws.Range("impact") With Me.entry_Impact .AddItem cImpact.Value End With Next cImpact 'Me.txtDate.Value = Format(Date, "Medium Date") Me.entry_RequestDate.Value = Format(Date, "Medium Date") Me.entry_ApprovedDate.Value = Format(Date, "Medium Date") Me.entry_StartDate.Value = Format(Date, "Medium Date") Me.entry_TargetDate.Value = Format(Date, "Medium Date") 'Me.txtQty.Value = 1 Me.entry_ITQ.SetFocus End Sub Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) If CloseMode = vbFormControlMenu Then Cancel = True MsgBox "Please use the Close Form button!" End If End Sub Any help towards the solution would be highly appreciated. Thank you. Last edited by Shane.Hutchison; 10-21-2015 at 12:06 PM. Reason: add file with corrected form access |
#2
|
|||
|
|||
HI,
Can you provide more information. Give us a example of your input and where you expect the data to go. I went through your file and was unable to determine what you were talking about. Are you wanting a "Listbox" to populate. If so which. |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Mail Merge Field Not Populating | JennEx | Mail Merge | 3 | 05-10-2015 09:30 PM |
Slow populating file using excel 2013 | hosshaku | Excel | 0 | 01-10-2014 12:40 PM |
Field not showing in Pivot Table Field List | kmcovington | Excel | 0 | 10-26-2012 10:14 AM |
"Auto-populating" data-worksheet to worksheet. | meggenm | Excel | 4 | 02-04-2012 02:04 AM |
Populating ComboBox or Drop Down list with contents of a text field | Billy_McSkintos | Word VBA | 1 | 09-13-2011 05:50 AM |