LISTOBJECT question

M

Marek

it is correct way to complete my task or not

my task is:

1. using combobox i can add and delete items in Listobject object

on the worksheet i have 3 components

combobo
button.add ( add item from combobox to listobject object )
button.delete ( delete item from listobject object )


my function to add items into combobox is next

Sub FizikaObjectAdd()
With Worksheets(4).ListObjects(1)
Set newrow = .ListRows.Add
Worksheets(4).Cells(.ListRows(newrow.Index).Range.Row
.ListColumns(1).Range.Column).Value = Worksheets(1).combo3.Text
Worksheets(4).Cells(.ListRows(newrow.Index).Range.Row
.ListColumns(2).Range.Column).Value = CStr(newrow.Index)
End With

Call ObjectListRefresh
End Sub


function to delete items from listobject object is next

Sub FizikaObjectDelete()
With Worksheets(4).ListObjects(1)
For c1 = .ListRows.Count To 1 Step -1
If Worksheets(4).Cells(.ListRows(c1).Range.Row
.ListColumns(1).Range.Column).Text = Worksheets(1).combo3.Text Then
.ListRows(c1).Delete
End If
Next
End With
Call FizikaObjectListRefresh
End Sub



can anyone tell me if my solution correct,

why i ask you ?, because i dont realy know is my way to access items i
the listobject object correct or not ?

for example
Worksheets(4).Cells(.ListRows(c1).Range.Row
.ListColumns(1).Range.Column).Tex
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top