Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a listbox which displays a table of chemicals (1st column) and their
properties - density (2nd column) and other propeties (3rd, 4th, 5th column etc) When I open the userform the table of chemicals is displayed and i can select a row of chemicals (highlighted in blue). I already have another userform which allows me to enter new chemicals to add to the list and I have txt boxes for entering the chemical data Here is the code i use for that Private Sub cmdAdd_Click() Application.EnableEvents = False Dim iRow As Long Dim ws As Worksheet Set ws = Worksheets("Chemicals") '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.txtChemical.Value) = "" Then Me.txtChemical.SetFocus MsgBox "Please enter a chemical name" Exit Sub End If 'copy the data to the database ws.Cells(iRow, 1).Value = Me.txtChemical.Value ws.Cells(iRow, 2).Value = Me.txtCAS.Value ws.Cells(iRow, 3).Value = Me.txtMW.Value ws.Cells(iRow, 4).Value = Me.txtDensity.Value ws.Cells(iRow, 5).Value = Me.txtMP.Value ws.Cells(iRow, 6).Value = Me.txtBP.Value ws.Cells(iRow, 7).Value = Me.txtFP.Value ws.Cells(iRow, 8).Value = Me.txtMSDS.Value 'clear the data Me.txtChemical.Value = "" Me.txtCAS.Value = "" Me.txtMW.Value = "" Me.txtDensity.Value = "" Me.txtMP.Value = "" Me.txtBP.Value = "" Me.txtFP.Value = "" Me.txtMSDS.Value = "" Me.txtChemical.SetFocus 'Application.EnableEvents = True End Sub What I am looking to do on the first userform (which displays all the chemicals is to select a row and have that data pulled to the different text boxes so that the individual properties can be edited and the table updated. Can anyone help me with this or dierct me to a link whereby a table of data can be appended to and/or edited. regards, Roger |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Pivot Table filter--can the select (All) option be eliminated? | Excel Discussion (Misc queries) | |||
macro to select option button in option group | Excel Programming | |||
Select & edit items in a listbox in VBA | Excel Programming | |||
SELECT, ERASE, EDIT items in listbox | Excel Programming | |||
Select from table and listbox | Excel Programming |