N
notsureofthatinfo
I am embarassed to show how much I don't know about this.
This presents everything the way I want, filtering for the State I
want in the form, and I can dump it to a textbox to edit but NOW I see
that storing the edited version will pose problems.
Basically I see that I went about this all wrong because I am lost
when it comes to knowing how to do this with arrays.
This code populates a listbox by first getting the variable it needs
from a clickable map.
Thanks to anyone who can help me understand.
Scott
------
Private Sub UserForm_Initialize()
Dim Contact As String
Dim phone As String
Dim str As String
'pull the State variable from another sub
'to build the listbox contents
UserForm1.Caption = State
ListBox1.ColumnCount = 4
'I want this to be a multicolumn listbox eventually
On Error Resume Next
EntryCount = 1 'to set the starting value
For Each Cell In Sheets("Security").Range("e2:e2000")
'the State is stored in column E
EntryCount = EntryCount + 1 'since the index starts at zero
'and we use the 1st row as a header
Contact = Cell.Offset(0, -4)
phone = Cell.Offset(0, 2)
str = EntryCount & vbTab & State & vbTab & Contact & vbTab & phone
If Cell = State Then ListBox1.AddItem (str) Else
Next Cell
EntryCount = 0
ListBox1.TextColumn = -1
CommandButton1.Caption = "Edit Selection"
CommandButton2.Caption = "Remove Selection"
End Sub
This presents everything the way I want, filtering for the State I
want in the form, and I can dump it to a textbox to edit but NOW I see
that storing the edited version will pose problems.
Basically I see that I went about this all wrong because I am lost
when it comes to knowing how to do this with arrays.
This code populates a listbox by first getting the variable it needs
from a clickable map.
Thanks to anyone who can help me understand.
Scott
------
Private Sub UserForm_Initialize()
Dim Contact As String
Dim phone As String
Dim str As String
'pull the State variable from another sub
'to build the listbox contents
UserForm1.Caption = State
ListBox1.ColumnCount = 4
'I want this to be a multicolumn listbox eventually
On Error Resume Next
EntryCount = 1 'to set the starting value
For Each Cell In Sheets("Security").Range("e2:e2000")
'the State is stored in column E
EntryCount = EntryCount + 1 'since the index starts at zero
'and we use the 1st row as a header
Contact = Cell.Offset(0, -4)
phone = Cell.Offset(0, 2)
str = EntryCount & vbTab & State & vbTab & Contact & vbTab & phone
If Cell = State Then ListBox1.AddItem (str) Else
Next Cell
EntryCount = 0
ListBox1.TextColumn = -1
CommandButton1.Caption = "Edit Selection"
CommandButton2.Caption = "Remove Selection"
End Sub