Visual Basic

Módulo1 - 1 Sub Macro3() ' ' Macro3 Macro ' ' ActiveSheet.ShowAllData End Sub Módulo2 - 1 ''''''''''''''''''''''''''''

Views 242 Downloads 12 File size 13KB

Report DMCA / Copyright

DOWNLOAD FILE

Recommend stories

Citation preview

Módulo1 - 1 Sub Macro3() ' ' Macro3 Macro ' ' ActiveSheet.ShowAllData End Sub

Módulo2 - 1 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Gustavo A. Sebastiani Cépeda ' ' Excel Negocios ' ' www.excelnegocios.com ' ' [email protected] ' ' (51) 970982933 - rpm #970982933 ' ' Soluciones inteligentes para tu hoja de cálculo ' ' Si usas este archivo, agradecería dar los créditos ' ' NOTA:Favor de avisarme en caso alguien este copiando el contenido de esta ' ' web como si fuera suyo, ya he detectado a varios. ' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Option Public Public Public

Private Module fin As Single fin2 As Integer n_cuentas As Integer

Sub mayorizar() limpiamos Cuentas_unicas autofiltro_porcuenta acomodamos formatos End Sub Sub Cuentas_unicas() 'filtramos unicos fin = Range("g65536").End(xlUp).Row Range("G7:G" & fin).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range( _ "L7"), Unique:=True End Sub Sub autofiltro_porcuenta() 'autofiltro por cuenta On Error Resume Next fin2 = Range("l65536").End(xlUp).Row n_cuentas = fin2 - 7 For i = 8 To fin2 ActiveSheet.Range("a7:j" & fin).AutoFilter Field:=7, Criteria1:=Range("l" & i).Value 'copiamos los datos de la cuenta filtrada. Range("a8:j" & fin).SpecialCells(xlCellTypeVisible).Copy Sheets("Mayor").Select Range("A65536").End(xlUp).Offset(6, 0).Select ActiveSheet.Paste Sheets("diario").Select Next i End Sub Sub acomodamos() 'acomodamos formatos 'eliminamos columnas que no sirven With Sheets("Mayor") .Select .Columns("d:f").EntireColumn.Delete 'acomodamos columnas .Columns("A:C").Cut .Columns("F:F").Insert Shift:=xlToRight '.Columns("a:g").AutoFit .Range("a7").Select End With End Sub Sub formatos() ' colocamos los formatos For i = 1 To n_cuentas Sheets("formato").Rows("1:7").Copy

Módulo2 - 2 Sheets("Mayor").Select tu = ActiveCell.Row Selection.Insert Shift:=xlDown Sheets("formato").Range("e11:g13").Copy 'corregido If ActiveCell.Offset(8, 0) = "" Then ActiveCell.Offset(8, 4).Select Else ActiveCell.Offset(7, 0).End(xlDown).Offset(1, 4).Select End If ActiveSheet.Paste ActiveCell.Offset(0, 1).Formula = "=sum(" & ActiveCell.Offset(-1, 1).Address(False, False) & ":" & Range("f" & tu + 7).Address(False, False) & ")" ActiveCell.Offset(0, 2).Formula = "=sum(" & ActiveCell.Offset(-1, 2).Address(False, Fal se) & ":" & Range("g" & tu + 7).Address(False, False) & ")" ActiveCell.Offset(5, -4).Select

'

Next i Columns("b:b").AutoFit Columns("e:g").AutoFit Rows("1:5").Delete Columns("F:G").NumberFormat = "_(* #,##0.00_);_(* (#,##0.00);_(* ""-""??_);_(@_)"

Hoja1.Select ActiveSheet.ShowAllData End Sub

Sub limpiamos() Hoja1.Columns("l:l").EntireColumn.Delete Hoja3.Cells.Delete End Sub