View Single Post
 
Old 03-27-2012, 11:13 AM
marreco marreco is offline Windows XP Office 2007
Novice
 
Join Date: Mar 2012
Posts: 8
marreco is on a distinguished road
Default as the return value of another column, using Listbox?

Hi

I have a listbox with 3 columns, I want to return the value from column 2


Code:
Private Sub CommandButton1_Click()

Dim i, j, UltimaLinha As Integer
Const FOR_READING = 1
Const FOR_WRITING = 2
Const FOR_APPENDING = 8

    For i = 0 To ListBox1.ListCount - 1
        If ListBox2.List(i) = True Then
                Sheets("Plan1").Activate 'Seleciona a planilha Banco
                Range("3:3").Select 'Seleciona a Linha 2 para inserção de nova linha
                Selection.Insert Shift:=xlDown 'Insere uma linha e coloca o banco para baixo
                Range("A1").Select 'Seleciona a primeira celula da base para inserção de dados

                ActiveCell.Value = Range("A2").Value + 1
                ActiveCell.Offset(0, 1).Value = "GRAFICA E EDITORA REVENDA PRINT LTDA"
                ActiveCell.Offset(0, 2).Value = CDate(Now)
              ActiveCell.Offset(0, 6).Value = Val(ListBox2.List(i))
    If datavencimento.Value = "" Then
        MsgBox "Data de Vencimento exigida!"
        Exit Sub
    Else: ActiveCell.Offset(0, 8).Value = CDate(datavencimento.Value)
    End If
    If dataenvio.Value = "" Then
        MsgBox "Data de Envio exigida!"
        Exit Sub
    Else
        ActiveCell.Offset(0, 13).Value = CDate(dataenvio.Value)
    End If

ActiveCell.Offset(0, 9).Value = historico.Text
ActiveCell.Offset(0, 10).Value = "ABERTA"
ActiveCell.Offset(0, 11).Value = Val(ListBox2.List(i))
                
        End If
    Next



MsgBox "Lançamento realizado com sucesso!"

End Sub
Reply With Quote