0% found this document useful (0 votes)
63 views

Macro

The document contains code that reorganizes and formats columns in a spreadsheet. It deletes unused columns, cuts and inserts columns to rearrange them, sets column widths, inserts headers, and applies borders and formatting to cells. Key cells are highlighted and descriptive text is added. The code prepares a spreadsheet for presentation by organizing and styling the data.

Uploaded by

danilo1529
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views

Macro

The document contains code that reorganizes and formats columns in a spreadsheet. It deletes unused columns, cuts and inserts columns to rearrange them, sets column widths, inserts headers, and applies borders and formatting to cells. Key cells are highlighted and descriptive text is added. The code prepares a spreadsheet for presentation by organizing and styling the data.

Uploaded by

danilo1529
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 6

Private Sub cmdFinalizar_Click()

Dim UltimaFila As Long


Dim LastRow As Long
Columns("AW:BK").Select
Columns("AW:BK").Delete
Columns("AU:AU").Select
Columns("AU:AU").Delete
Columns("AE:AQ").Select
Columns("AE:AQ").Delete
Columns("Y:AC").Select
Columns("Y:AC").Delete
Columns("M:W").Select
Columns("M:W").Delete
Columns("K:K").Select
Columns("K:K").Delete
Columns("I:I").Select
Columns("I:I").Delete
Columns("G:G").Select
Columns("G:G").Delete
Columns("C:E").Select
Columns("C:E").Delete
Columns("A:A").Select
Columns("A:A").Delete
Columns("C:C").Select
Selection.Cut
Columns("A:A").Select
Selection.Insert Shift:=xlToRight
Columns("C:C").Select
Selection.Cut
Columns("B:B").Select
Selection.Insert Shift:=xlToRight
Columns("D:D").Select
Selection.Cut
Columns("C:C").Select
Selection.Insert Shift:=xlToRight
Columns("H:H").Select
Selection.Cut
Columns("F:F").Select
Selection.Insert Shift:=xlToRight

Columns("I:I").Select
Selection.Cut
Columns("G:G").Select
Selection.Insert Shift:=xlToRight
Columns("J:J").Select
Selection.Cut
Columns("H:H").Select
Selection.Insert Shift:=xlToRight
Columns("K:K").Select
Selection.Cut
Columns("J:J").Select
Selection.Insert Shift:=xlToRight
Range("A1").Select
ActiveCell.FormulaR1C1 = "PROYECTO"
Range("B1").Select
ActiveCell.FormulaR1C1 = "SOT"
Range("C1").Select
ActiveCell.FormulaR1C1 = "CID"
Range("D1").Select
ActiveCell.FormulaR1C1 = "CLIENTE"
Range("E1").Select
ActiveCell.FormulaR1C1 = "DESCRIPCION"
Range("F1").Select
ActiveCell.FormulaR1C1 = "SERVICIO"
Range("G1").Select
ActiveCell.FormulaR1C1 = "PRODUCTO"
Range("H1").Select
ActiveCell.FormulaR1C1 = "DESCRIPCION"
Range("I1").Select
ActiveCell.FormulaR1C1 = "RESPONSABILIDAD"
Range("J1").Select
ActiveCell.FormulaR1C1 = "CONTRATA"
Range("K1").Select
ActiveCell.FormulaR1C1 = "OBSERVACIONES"
Range("L1").Select
ActiveCell.FormulaR1C1 = "STATUS CNS"
'UltimaFila = Range("B1").End(xlDown).Row
'Cells(UltimaFila, 1).Select
'ActiveCell.Value = "Hola"
If WorksheetFunction.CountA(Cells) > 0 Then
'Search for any entry, by searching backwards by Rows.
LastRow = Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByRows, Sear
chDirection:=xlPrevious).Row
'MsgBox LastRow
End If
' ---------------+++++++++++++++++++++++++++++++---------
' Arreglo de cuadriculado

ActiveSheet.Range("A1", "L" & LastRow).Select


Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With

' ---------------+++++++++++++++++++++++++++++++---------
' Arreglo de marcacion resaltada total
ActiveSheet.Range("A1", "L" & LastRow).Select
' Selection.Borders(xlDiagonalDown).LineStyle = xlNone
' Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With

' ---------------+++++++++++++++++++++++++++++++---------
' Arreglo de marcacion resaltada titulo
ActiveSheet.Range("A1", "L1").Select
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
' Selection.Borders(xlInsideVertical).LineStyle = xlNone
' Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Range("A1:L1").Select
Selection.Font.Bold = True
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
' ActiveWindow.SmallScroll Down:=9
Columns("A:A").ColumnWidth = 10
Columns("B:B").ColumnWidth = 10
Columns("C:C").ColumnWidth = 10
Columns("D:D").ColumnWidth = 35
Columns("E:E").ColumnWidth = 35
Columns("F:F").ColumnWidth = 35
Columns("G:G").ColumnWidth = 30
Columns("H:H").ColumnWidth = 25
Columns("I:I").ColumnWidth = 15
Columns("J:J").ColumnWidth = 15
Columns("K:K").ColumnWidth = 15
Columns("L:L").ColumnWidth = 20
' Cells(UltimaFila, 1).Select
' ---------------+++++++++++++++++++++++++++++++---------
' Arreglo de marcacion resaltada titulo
ActiveSheet.Range("D" & LastRow + 6).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 13421619
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveCell.Value = "Sin diseño / Sin IP"
ActiveSheet.Range("D" & LastRow + 7).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 16737996
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveCell.Value = "Cancelado / Reprogramado"

ActiveSheet.Range("D" & LastRow + 8).Select


ActiveCell.Value = "Ok / Preconfigurado"
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65280
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveCell.Value = "Ok / Preconfigurado"

ActiveSheet.Range("D" & LastRow + 9).Select


With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With Selection.Font
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
End With
ActiveCell.Value = "Proyecto especial"

ActiveSheet.Range("D" & LastRow + 10).Select


With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.249977111117893
.PatternTintAndShade = 0
End With
ActiveCell.Value = "CNS no interviene"

ActiveSheet.Range("D" & LastRow + 11).Select


With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 39270
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveCell.Value = "SOT MAL GENERADA"
ActiveSheet.Range("D" & LastRow + 12).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 10066431
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveCell.Value = "EJECUTAR EN CAMPO"
ActiveSheet.Range("D" & LastRow + 13).Select
ActiveCell.Value = "Ing. On Site"
ActiveSheet.Range("D" & LastRow + 14).Select
ActiveCell.Value = "Falta de recurso/ asignación"
ActiveSheet.Range("D" & LastRow + 14).Select
ActiveCell.Value = "ATENDIDO FUERA DE PROGRAMACION"

ActiveSheet.Range("D" & LastRow + 14).Select


ActiveCell.Value = "ATENDIDO DENTRO DE LA PROGRAMACION"
ActiveSheet.Range("D" & LastRow + 14).Select
ActiveCell.Value = "Up-Grade Ejecutar Remotamente."
'Cells("A1", "L" & LastRow)

End Sub

You might also like