LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default listbox -shows table of information - option to select and edit ro

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
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
Pivot Table filter--can the select (All) option be eliminated? MichelleH Excel Discussion (Misc queries) 0 March 15th 10 03:13 PM
macro to select option button in option group cm Excel Programming 2 October 20th 09 04:49 PM
Select & edit items in a listbox in VBA poppy Excel Programming 6 May 12th 06 01:10 PM
SELECT, ERASE, EDIT items in listbox unplugs[_29_] Excel Programming 10 June 30th 04 04:56 AM
Select from table and listbox PawelR Excel Programming 1 November 7th 03 01:21 PM


All times are GMT +1. The time now is 08:15 PM.

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"