Userform de Cadastro com Listbox
Enviado: Seg Out 19, 2009 6:51 pm
Pessoal, tenho um userform de cadastro no qual tenho uma listbox com as áreas de atuação - porém quando habilito a propriedade fmMultiSelectMulti para cadastrar vários itens no campo de Area de Atuação (WS.Cells(iRow, 39).Value = Me.ListBox1.Value) em uma coluna apenas - separado por ponto e virgula..é possível?
Código do Userform de Cadastro:
Private Sub CommandButton1_Click()
'Introdução dos dados na Planilha
Dim iRow As Long
Dim WS As Worksheet
Set WS = Worksheets("Fornecedor")
'find first empty row in database
iRow = WS.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
'copy the data to the database
WS.Cells(iRow, 1).Value = Me.TextBox1.Value
WS.Cells(iRow, 2).Value = Me.TextBox2.Value
WS.Cells(iRow, 3).Value = Me.TextBox3.Value
WS.Cells(iRow, 4).Value = Me.TextBox46.Value
WS.Cells(iRow, 5).Value = Me.TextBox4.Value
WS.Cells(iRow, 6).Value = Me.TextBox5.Value
WS.Cells(iRow, 7).Value = Me.TextBox6.Value
WS.Cells(iRow, 8).Value = Me.TextBox8.Value
WS.Cells(iRow, 9).Value = Me.TextBox9.Value
WS.Cells(iRow, 10).Value = Me.TextBox10.Value
WS.Cells(iRow, 11).Value = Me.ComboBox1.Value
WS.Cells(iRow, 12).Value = Me.TextBox12.Value
WS.Cells(iRow, 13).Value = Me.TextBox13.Value
WS.Cells(iRow, 14).Value = Me.TextBox14.Value
WS.Cells(iRow, 15).Value = Me.TextBox15.Value
WS.Cells(iRow, 16).Value = Me.TextBox16.Value
WS.Cells(iRow, 17).Value = Me.TextBox18.Value
WS.Cells(iRow, 18).Value = Me.TextBox19.Value
WS.Cells(iRow, 19).Value = Me.TextBox20.Value
WS.Cells(iRow, 20).Value = Me.TextBox21.Value
WS.Cells(iRow, 21).Value = Me.TextBox22.Value
WS.Cells(iRow, 22).Value = Me.TextBox23.Value
WS.Cells(iRow, 23).Value = Me.TextBox24.Value
WS.Cells(iRow, 24).Value = Me.TextBox25.Value
WS.Cells(iRow, 25).Value = Me.TextBox26.Value
WS.Cells(iRow, 26).Value = Me.TextBox27.Value
WS.Cells(iRow, 27).Value = Me.TextBox28.Value
WS.Cells(iRow, 28).Value = Me.TextBox29.Value
WS.Cells(iRow, 29).Value = Me.TextBox30.Value
WS.Cells(iRow, 30).Value = Me.TextBox31.Value
WS.Cells(iRow, 31).Value = Me.TextBox32.Value
WS.Cells(iRow, 32).Value = Me.TextBox33.Value
WS.Cells(iRow, 33).Value = Me.TextBox34.Value
WS.Cells(iRow, 34).Value = Me.TextBox35.Value
WS.Cells(iRow, 35).Value = Me.TextBox36.Value
WS.Cells(iRow, 36).Value = Me.TextBox37.Value
WS.Cells(iRow, 37).Value = Me.TextBox38.Value
WS.Cells(iRow, 38).Value = Me.TextBox39.Value
WS.Cells(iRow, 39).Value = Me.ListBox1.Value
WS.Cells(iRow, 40).Value = Me.TextBox40.Value
WS.Cells(iRow, 41).Value = Me.TextBox41.Value
WS.Cells(iRow, 42).Value = Me.TextBox42.Value
WS.Cells(iRow, 43).Value = Me.TextBox43.Value
WS.Cells(iRow, 44).Value = Me.TextBox44.Value
WS.Cells(iRow, 45).Value = Me.TextBox45.Value
'clear the data
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox46.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox8.Text = ""
TextBox9.Text = ""
TextBox10.Text = ""
ComboBox1.Value = ""
TextBox12.Text = ""
TextBox13.Text = ""
TextBox14.Text = ""
TextBox15.Text = ""
TextBox16.Text = ""
TextBox18.Text = ""
TextBox19.Text = ""
TextBox20.Text = ""
TextBox21.Text = ""
TextBox22.Text = ""
TextBox23.Text = ""
TextBox24.Text = ""
TextBox25.Text = ""
TextBox26.Text = ""
TextBox27.Text = ""
TextBox28.Text = ""
TextBox29.Text = ""
TextBox30.Text = ""
TextBox31.Text = ""
TextBox32.Text = ""
TextBox33.Text = ""
TextBox34.Text = ""
TextBox35.Text = ""
TextBox36.Text = ""
TextBox37.Text = ""
TextBox38.Text = ""
TextBox39.Text = ""
TextBox40.Text = ""
TextBox41.Text = ""
TextBox42.Text = ""
TextBox43.Text = ""
TextBox44.Text = ""
TextBox45.Text = ""
TextBox1.SetFocus
End Sub
Código do Userform de Cadastro:
Private Sub CommandButton1_Click()
'Introdução dos dados na Planilha
Dim iRow As Long
Dim WS As Worksheet
Set WS = Worksheets("Fornecedor")
'find first empty row in database
iRow = WS.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
'copy the data to the database
WS.Cells(iRow, 1).Value = Me.TextBox1.Value
WS.Cells(iRow, 2).Value = Me.TextBox2.Value
WS.Cells(iRow, 3).Value = Me.TextBox3.Value
WS.Cells(iRow, 4).Value = Me.TextBox46.Value
WS.Cells(iRow, 5).Value = Me.TextBox4.Value
WS.Cells(iRow, 6).Value = Me.TextBox5.Value
WS.Cells(iRow, 7).Value = Me.TextBox6.Value
WS.Cells(iRow, 8).Value = Me.TextBox8.Value
WS.Cells(iRow, 9).Value = Me.TextBox9.Value
WS.Cells(iRow, 10).Value = Me.TextBox10.Value
WS.Cells(iRow, 11).Value = Me.ComboBox1.Value
WS.Cells(iRow, 12).Value = Me.TextBox12.Value
WS.Cells(iRow, 13).Value = Me.TextBox13.Value
WS.Cells(iRow, 14).Value = Me.TextBox14.Value
WS.Cells(iRow, 15).Value = Me.TextBox15.Value
WS.Cells(iRow, 16).Value = Me.TextBox16.Value
WS.Cells(iRow, 17).Value = Me.TextBox18.Value
WS.Cells(iRow, 18).Value = Me.TextBox19.Value
WS.Cells(iRow, 19).Value = Me.TextBox20.Value
WS.Cells(iRow, 20).Value = Me.TextBox21.Value
WS.Cells(iRow, 21).Value = Me.TextBox22.Value
WS.Cells(iRow, 22).Value = Me.TextBox23.Value
WS.Cells(iRow, 23).Value = Me.TextBox24.Value
WS.Cells(iRow, 24).Value = Me.TextBox25.Value
WS.Cells(iRow, 25).Value = Me.TextBox26.Value
WS.Cells(iRow, 26).Value = Me.TextBox27.Value
WS.Cells(iRow, 27).Value = Me.TextBox28.Value
WS.Cells(iRow, 28).Value = Me.TextBox29.Value
WS.Cells(iRow, 29).Value = Me.TextBox30.Value
WS.Cells(iRow, 30).Value = Me.TextBox31.Value
WS.Cells(iRow, 31).Value = Me.TextBox32.Value
WS.Cells(iRow, 32).Value = Me.TextBox33.Value
WS.Cells(iRow, 33).Value = Me.TextBox34.Value
WS.Cells(iRow, 34).Value = Me.TextBox35.Value
WS.Cells(iRow, 35).Value = Me.TextBox36.Value
WS.Cells(iRow, 36).Value = Me.TextBox37.Value
WS.Cells(iRow, 37).Value = Me.TextBox38.Value
WS.Cells(iRow, 38).Value = Me.TextBox39.Value
WS.Cells(iRow, 39).Value = Me.ListBox1.Value
WS.Cells(iRow, 40).Value = Me.TextBox40.Value
WS.Cells(iRow, 41).Value = Me.TextBox41.Value
WS.Cells(iRow, 42).Value = Me.TextBox42.Value
WS.Cells(iRow, 43).Value = Me.TextBox43.Value
WS.Cells(iRow, 44).Value = Me.TextBox44.Value
WS.Cells(iRow, 45).Value = Me.TextBox45.Value
'clear the data
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox46.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox8.Text = ""
TextBox9.Text = ""
TextBox10.Text = ""
ComboBox1.Value = ""
TextBox12.Text = ""
TextBox13.Text = ""
TextBox14.Text = ""
TextBox15.Text = ""
TextBox16.Text = ""
TextBox18.Text = ""
TextBox19.Text = ""
TextBox20.Text = ""
TextBox21.Text = ""
TextBox22.Text = ""
TextBox23.Text = ""
TextBox24.Text = ""
TextBox25.Text = ""
TextBox26.Text = ""
TextBox27.Text = ""
TextBox28.Text = ""
TextBox29.Text = ""
TextBox30.Text = ""
TextBox31.Text = ""
TextBox32.Text = ""
TextBox33.Text = ""
TextBox34.Text = ""
TextBox35.Text = ""
TextBox36.Text = ""
TextBox37.Text = ""
TextBox38.Text = ""
TextBox39.Text = ""
TextBox40.Text = ""
TextBox41.Text = ""
TextBox42.Text = ""
TextBox43.Text = ""
TextBox44.Text = ""
TextBox45.Text = ""
TextBox1.SetFocus
End Sub