códigos bva

3
Private Sub CLINOMBRE_Change() Application.ScreenUpdating = False Sheets("CLIENTES").Select Range("C5").Select LISTACLI.Clear While ActiveCell.Value <> "" M = InStr(1, UCase(ActiveCell.Value), UCase(CLINOMBRE.Text)) If M > 0 Then LISTACLI.ColumnCount = 6 LISTACLI.AddItem ActiveCell.Offset(0, -1).Select LISTACLI.List(LISTACLI.ListCount - 1, 0) = ActiveCell.Value ActiveCell.Offset(0, 1).Select LISTACLI.List(LISTACLI.ListCount - 1, 1) = ActiveCell.Value ActiveCell.Offset(0, 1).Select LISTACLI.List(LISTACLI.ListCount - 1, 2) = ActiveCell.Value ActiveCell.Offset(0, 1).Select LISTACLI.List(LISTACLI.ListCount - 1, 3) = ActiveCell.Value ActiveCell.Offset(0, 1).Select LISTACLI.List(LISTACLI.ListCount - 1, 4) = ActiveCell.Value ActiveCell.Offset(0, 1).Select LISTACLI.List(LISTACLI.ListCount - 1, 5) = ActiveCell.Value ActiveCell.Offset(0, -4).Select End If ActiveCell.Offset(1, 0).Select Wend Sheets("FACTURA").Select Range("A1").Select Application.ScreenUpdating = True End Sub Private Sub CLIIDENTIDAD_Change() Application.ScreenUpdating = False Sheets("CLIENTES").Select Range("G5").Select LISTACLI.Clear While ActiveCell.Value <> "" M = InStr(1, UCase(ActiveCell.Value), UCase(CLIIDENTIDAD.Text)) If M > 0 Then LISTACLI.ColumnCount = 6 LISTACLI.AddItem ActiveCell.Offset(0, -5).Select LISTACLI.List(LISTACLI.ListCount - 1, 0) = ActiveCell.Value ActiveCell.Offset(0, 1).Select LISTACLI.List(LISTACLI.ListCount - 1, 1) = ActiveCell.Value

Upload: dariocutipa

Post on 07-Jul-2016

228 views

Category:

Documents


0 download

DESCRIPTION

VBA

TRANSCRIPT

Page 1: Códigos BVA

Private Sub CLINOMBRE_Change()Application.ScreenUpdating = FalseSheets("CLIENTES").SelectRange("C5").SelectLISTACLI.ClearWhile ActiveCell.Value <> ""M = InStr(1, UCase(ActiveCell.Value), UCase(CLINOMBRE.Text))If M > 0 ThenLISTACLI.ColumnCount = 6LISTACLI.AddItemActiveCell.Offset(0, -1).SelectLISTACLI.List(LISTACLI.ListCount - 1, 0) = ActiveCell.ValueActiveCell.Offset(0, 1).SelectLISTACLI.List(LISTACLI.ListCount - 1, 1) = ActiveCell.ValueActiveCell.Offset(0, 1).SelectLISTACLI.List(LISTACLI.ListCount - 1, 2) = ActiveCell.ValueActiveCell.Offset(0, 1).SelectLISTACLI.List(LISTACLI.ListCount - 1, 3) = ActiveCell.ValueActiveCell.Offset(0, 1).SelectLISTACLI.List(LISTACLI.ListCount - 1, 4) = ActiveCell.ValueActiveCell.Offset(0, 1).SelectLISTACLI.List(LISTACLI.ListCount - 1, 5) = ActiveCell.ValueActiveCell.Offset(0, -4).SelectEnd IfActiveCell.Offset(1, 0).Select

Wend

Sheets("FACTURA").SelectRange("A1").Select

Application.ScreenUpdating = TrueEnd SubPrivate Sub CLIIDENTIDAD_Change()Application.ScreenUpdating = FalseSheets("CLIENTES").SelectRange("G5").SelectLISTACLI.ClearWhile ActiveCell.Value <> ""M = InStr(1, UCase(ActiveCell.Value), UCase(CLIIDENTIDAD.Text))If M > 0 ThenLISTACLI.ColumnCount = 6LISTACLI.AddItemActiveCell.Offset(0, -5).SelectLISTACLI.List(LISTACLI.ListCount - 1, 0) = ActiveCell.ValueActiveCell.Offset(0, 1).SelectLISTACLI.List(LISTACLI.ListCount - 1, 1) = ActiveCell.ValueActiveCell.Offset(0, 1).SelectLISTACLI.List(LISTACLI.ListCount - 1, 2) = ActiveCell.ValueActiveCell.Offset(0, 1).SelectLISTACLI.List(LISTACLI.ListCount - 1, 3) = ActiveCell.ValueActiveCell.Offset(0, 1).SelectLISTACLI.List(LISTACLI.ListCount - 1, 4) = ActiveCell.ValueActiveCell.Offset(0, 1).SelectLISTACLI.List(LISTACLI.ListCount - 1, 5) = ActiveCell.ValueActiveCell.Offset(0, -0).Select

Page 2: Códigos BVA

End IfActiveCell.Offset(1, 0).Select

Wend

Sheets("FACTURA").SelectRange("A1").Select

Application.ScreenUpdating = TrueEnd Sub

Private Sub UserForm_Activate()Application.ScreenUpdating = False

Sheets("CLIENTES").SelectRange("B5").Select

While ActiveCell.Value <> ""ActiveCell.Offset(0, 50).Select

If ActiveCell.Value = 0 ThenActiveCell.Offset(0, -50).SelectLISTACLI.ColumnCount = 6LISTACLI.AddItemLISTACLI.List(LISTACLI.ListCount - 1, 0) = ActiveCell.ValueActiveCell.Offset(0, 1).SelectLISTACLI.List(LISTACLI.ListCount - 1, 1) = ActiveCell.ValueActiveCell.Offset(0, 1).SelectLISTACLI.List(LISTACLI.ListCount - 1, 2) = ActiveCell.ValueActiveCell.Offset(0, 1).SelectLISTACLI.List(LISTACLI.ListCount - 1, 3) = ActiveCell.ValueActiveCell.Offset(0, 1).SelectLISTACLI.List(LISTACLI.ListCount - 1, 4) = ActiveCell.ValueActiveCell.Offset(0, 1).SelectLISTACLI.List(LISTACLI.ListCount - 1, 5) = ActiveCell.Value

ActiveCell.Offset(1, -5).SelectElseActiveCell.Offset(1, -50).SelectEnd If

Wend

Sheets("FACTURA").SelectRange("A1").SelectApplication.ScreenUpdating = TrueEnd Sub

Private Sub LISTACLI_DblClick(ByVal Cancel As MSForms.ReturnBoolean)Application.ScreenUpdating = False

On Error GoTo ERR:L = LISTACLI.List(LISTACLI.ListIndex, 0)Sheets("CLIENTES").SelectRange("B5").Select

Page 3: Códigos BVA

While ActiveCell.Value <> "" And ActiveCell.Value <> L And ActiveCell.Value <> Val(L)ActiveCell.Offset(1, 0).SelectWend

If ActiveCell.Value = "" ThenUnload MeFORMULARIOCLI.Show

ElseCOD1 = ActiveCell.ValueActiveCell.Offset(0, 0).SelectNOMB1 = ActiveCell.Value

Sheets("FACTURA").SelectRange("C7").SelectActiveCell.Value = NOMB1Unload MeEnd If

ERR:End Sub