códigos bva

Post on 07-Jul-2016

228 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

VBA

TRANSCRIPT

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

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

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

top related