Facebook
From Agnieszka, 6 Years ago, written in Visual Basic.
Embed
Download Paste or View Raw
Hits: 356
  1. Sub finalv5()
  2. '
  3. ' finalv5 Makro
  4. '
  5. ' Klawisz skrótu: Ctrl+p
  6. '
  7.     ActiveWindow.ScrollColumn = 2
  8.     ActiveWindow.ScrollColumn = 3
  9.     ActiveWindow.ScrollColumn = 4
  10.     ActiveWindow.ScrollColumn = 5
  11.     ActiveWindow.ScrollColumn = 6
  12.     ActiveWindow.ScrollColumn = 7
  13.     Columns("O:P").Select
  14.     Range("Tabela_owssvr_1[[#Headers],[Ścieżka]]").Activate
  15.     Selection.Delete Shift:=xlToLeft
  16.     Columns("G:H").Select
  17.     Range("Tabela_owssvr_1[[#Headers],[Typ projektu]]").Activate
  18.     Selection.Delete Shift:=xlToLeft
  19.     Range("R14").Select
  20.     ActiveWindow.ScrollColumn = 6
  21.     ActiveWindow.ScrollColumn = 5
  22.     ActiveWindow.ScrollColumn = 4
  23.     ActiveWindow.ScrollColumn = 3
  24.     ActiveWindow.ScrollColumn = 1
  25.     Range("Tabela_owssvr_1[[#Headers],[Numer zmiany]]").Select
  26.     ActiveWindow.DisplayGridlines = False
  27.     Rows("1:1").Select
  28.     Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
  29.     Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
  30.     Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
  31.     Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
  32.     Columns("A:A").Select
  33.     Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
  34.     Range("B6").Select
  35.     ActiveSheet.ListObjects("Tabela_owssvr_1").TableStyle = "TableStyleMedium1"
  36.     Windows("finalv2.xlsm").Activate
  37.     Range("B2:C4").Select
  38.     Selection.Copy
  39.     Windows("Zeszyt1").Activate
  40.     Application.CutCopyMode = False
  41.     Range("B2").Select
  42.     ActiveCell.FormulaR1C1 = "WERYFIKACJA PROJEKTÓW PRZED DLT"
  43.     Range("B3").Select
  44.     ActiveCell.FormulaR1C1 = "Przygotowany dnia:"
  45.     Range("B4").Select
  46.     ActiveCell.FormulaR1C1 = "Okres:"
  47.     Range("C3").Select
  48.     ActiveCell.FormulaR1C1 = "=TODAY()"
  49.     Range("C4").Select
  50.     Windows("finalv2.xlsm").Activate
  51.     Range("C4").Select
  52.     Windows("Zeszyt1").Activate
  53.     ActiveCell.FormulaR1C1 = _
  54.         "=DAY(R[-1]C)&"".""&0&MONTH(R[-1]C)-2&"".""&YEAR(R[-1]C)&""-""&DAY(R[-1]C)&"".""&MONTH(R[-1]C)&"".""&YEAR(R[-1]C)"
  55.     Range("C4").Select
  56.     ActiveCell.FormulaR1C1 = _
  57.         "=DAY(R[-1]C)&"".""&0&MONTH(R[-1]C)-2&"".""&YEAR(R[-1]C)&""-""&DAY(R[-1]C)&"".""&0&MONTH(R[-1]C)&"".""&YEAR(R[-1]C)"
  58.     Range("C3:C4").Select
  59.     Selection.Font.Bold = True
  60.     With Selection
  61.         .HorizontalAlignment = xlLeft
  62.         .VerticalAlignment = xlBottom
  63.         .WrapText = False
  64.         .Orientation = 0
  65.         .AddIndent = False
  66.         .IndentLevel = 0
  67.         .ShrinkToFit = False
  68.         .ReadingOrder = xlContext
  69.         .MergeCells = False
  70.     End With
  71.     Range("B2").Select
  72.     Selection.Font.Bold = True
  73.     Range( _
  74.         "Tabela_owssvr_1[[#Headers],[Opis projektu____________________________________________________________________]]" _
  75.         ).Select
  76.     ActiveCell.FormulaR1C1 = "Opis projektu"
  77.     Columns("B:M").Select
  78.     Selection.ColumnWidth = 19.43
  79.     ActiveWindow.ScrollColumn = 5
  80.     ActiveWindow.ScrollColumn = 4
  81.     ActiveWindow.ScrollColumn = 3
  82.     ActiveWindow.ScrollColumn = 2
  83.     ActiveWindow.ScrollColumn = 1
  84.     Columns("D:E").Select
  85.     Selection.ColumnWidth = 33.43
  86.     Selection.ColumnWidth = 36.14
  87.     Range("Tabela_owssvr_1[#Headers]").Select
  88.     With Selection
  89.         .HorizontalAlignment = xlGeneral
  90.         .VerticalAlignment = xlCenter
  91.         .WrapText = False
  92.         .Orientation = 0
  93.         .AddIndent = False
  94.         .IndentLevel = 0
  95.         .ShrinkToFit = False
  96.         .ReadingOrder = xlContext
  97.         .MergeCells = False
  98.     End With
  99.     With Selection
  100.         .HorizontalAlignment = xlCenter
  101.         .VerticalAlignment = xlCenter
  102.         .WrapText = False
  103.         .Orientation = 0
  104.         .AddIndent = False
  105.         .IndentLevel = 0
  106.         .ShrinkToFit = False
  107.         .ReadingOrder = xlContext
  108.         .MergeCells = False
  109.     End With
  110.     Range("B6:M6").Select
  111.     Range(Selection, Selection.End(xlDown)).Select
  112.     Range(Selection, Selection.End(xlDown)).Select
  113.     With Selection
  114.         .HorizontalAlignment = xlGeneral
  115.         .VerticalAlignment = xlCenter
  116.         .Orientation = 0
  117.         .AddIndent = False
  118.         .IndentLevel = 0
  119.         .ShrinkToFit = False
  120.         .ReadingOrder = xlContext
  121.         .MergeCells = False
  122.     End With
  123.     With Selection
  124.         .HorizontalAlignment = xlLeft
  125.         .VerticalAlignment = xlCenter
  126.         .Orientation = 0
  127.         .AddIndent = False
  128.         .IndentLevel = 0
  129.         .ShrinkToFit = False
  130.         .ReadingOrder = xlContext
  131.         .MergeCells = False
  132.     End With
  133.     Range("H6:I6").Select
  134.     Range(Selection, Selection.End(xlDown)).Select
  135.     Range(Selection, Selection.End(xlDown)).Select
  136.     With Selection
  137.         .HorizontalAlignment = xlRight
  138.         .VerticalAlignment = xlCenter
  139.         .WrapText = False
  140.         .Orientation = 0
  141.         .AddIndent = False
  142.         .IndentLevel = 0
  143.         .ShrinkToFit = False
  144.         .ReadingOrder = xlContext
  145.         .MergeCells = False
  146.     End With
  147.     Range("L6").Select
  148.     Range(Selection, Selection.End(xlDown)).Select
  149.     Range(Selection, Selection.End(xlDown)).Select
  150.     Range(Selection, Selection.End(xlDown)).Select
  151.     Range(Selection, Selection.End(xlDown)).Select
  152.     Range(Selection, Selection.End(xlDown)).Select
  153.     Range(Selection, Selection.End(xlDown)).Select
  154.     Range(Selection, Selection.End(xlDown)).Select
  155.     With Selection
  156.         .HorizontalAlignment = xlRight
  157.         .VerticalAlignment = xlCenter
  158.         .WrapText = False
  159.         .Orientation = 0
  160.         .AddIndent = False
  161.         .IndentLevel = 0
  162.         .ShrinkToFit = False
  163.         .ReadingOrder = xlContext
  164.         .MergeCells = False
  165.     End With
  166.     ActiveWindow.SmallScroll Down:=-18
  167.     Range("Tabela_owssvr_1[[#Headers],[Nazwa zmiany]]").Select
  168.     Range(Selection, Selection.End(xlToRight)).Select
  169.     Range(Selection, Selection.End(xlDown)).Select
  170.     Range(Selection, Selection.End(xlDown)).Select
  171.     Range(Selection, Selection.End(xlDown)).Select
  172.     Range("Tabela_owssvr_1[[#Headers],[Numer zmiany]]").Select
  173.     Range(Selection, Selection.End(xlToRight)).Select
  174.     Range(Selection, Selection.End(xlToRight)).Select
  175.     Range(Selection, Selection.End(xlToLeft)).Select
  176.     Range(Selection, Selection.End(xlDown)).Select
  177.     Range(Selection, Selection.End(xlDown)).Select
  178.     With Selection
  179.         .VerticalAlignment = xlCenter
  180.         .WrapText = True
  181.         .Orientation = 0
  182.         .AddIndent = False
  183.         .IndentLevel = 0
  184.         .ShrinkToFit = False
  185.         .ReadingOrder = xlContext
  186.         .MergeCells = False
  187.     End With
  188.     ActiveWindow.SmallScroll Down:=-24
  189.     Range("F6").Select
  190.     Columns("F:F").ColumnWidth = 15.43
  191.     Columns("D:E").Select
  192.     Selection.ColumnWidth = 40.57
  193.     ActiveWindow.ScrollColumn = 2
  194.     ActiveWindow.ScrollColumn = 3
  195.     ActiveWindow.ScrollColumn = 4
  196.     ActiveWindow.ScrollColumn = 5
  197.     Columns("G:G").ColumnWidth = 23.43
  198.     Columns("G:G").ColumnWidth = 15.86
  199.     Columns("H:H").ColumnWidth = 14.14
  200.     Columns("I:I").ColumnWidth = 16.29
  201.     Columns("L:L").ColumnWidth = 12.43
  202.     ActiveWindow.ScrollColumn = 4
  203.     ActiveWindow.ScrollColumn = 3
  204.     ActiveWindow.ScrollColumn = 2
  205.     ActiveWindow.ScrollColumn = 1
  206.     Columns("D:E").Select
  207.     Selection.ColumnWidth = 46.14
  208.     Columns("E:E").Select
  209.     Selection.ColumnWidth = 48.57
  210.     Range("E6").Select
  211.     ActiveWindow.SmallScroll Down:=-27
  212.     Rows("5:5").Select
  213.     Range(Selection, Selection.End(xlDown)).Select
  214.     Rows("5:1048576").EntireRow.AutoFit
  215.     ActiveWindow.SmallScroll Down:=-42
  216.     Range("B1048509").Select
  217.     Selection.End(xlUp).Select
  218.     Range("B166").Select
  219.     Selection.End(xlUp).Select
  220.     Range("B6").Select
  221.     ActiveWindow.SmallScroll Down:=-30
  222.     Range("D6").Select
  223.     ActiveWindow.FreezePanes = True
  224.     Range("A1").Select
  225.     ActiveWindow.SmallScroll Down:=-15
  226.     ActiveWindow.ScrollColumn = 5
  227.     ActiveWindow.ScrollColumn = 6
  228.     ActiveWindow.ScrollColumn = 5
  229.     ActiveWindow.ScrollColumn = 4
  230.     ActiveWindow.SmallScroll Down:=-27
  231.     Application.PrintCommunication = False
  232.     With ActiveSheet.PageSetup
  233.         .PrintTitleRows = ""
  234.         .PrintTitleColumns = ""
  235.     End With
  236.     Application.PrintCommunication = True
  237.     ActiveSheet.PageSetup.PrintArea = ""
  238.     Application.PrintCommunication = False
  239.     With ActiveSheet.PageSetup
  240.         .LeftHeader = ""
  241.         .CenterHeader = ""
  242.         .RightHeader = ""
  243.         .LeftFooter = ""
  244.         .CenterFooter = ""
  245.         .RightFooter = ""
  246.         .LeftMargin = Application.InchesToPoints(0.7)
  247.         .RightMargin = Application.InchesToPoints(0.7)
  248.         .TopMargin = Application.InchesToPoints(0.75)
  249.         .BottomMargin = Application.InchesToPoints(0.75)
  250.         .HeaderMargin = Application.InchesToPoints(0.3)
  251.         .FooterMargin = Application.InchesToPoints(0.3)
  252.         .PrintHeadings = False
  253.         .PrintGridlines = False
  254.         .PrintComments = xlPrintNoComments
  255.         .PrintQuality = 600
  256.         .CenterHorizontally = False
  257.         .CenterVertically = False
  258.         .Orientation = xlLandscape
  259.         .Draft = False
  260.         .PaperSize = xlPaperA4
  261.         .FirstPageNumber = xlAutomatic
  262.         .Order = xlDownThenOver
  263.         .BlackAndWhite = False
  264.         .Zoom = 100
  265.         .PrintErrors = xlPrintErrorsDisplayed
  266.         .OddAndEvenPagesHeaderFooter = False
  267.         .DifferentFirstPageHeaderFooter = False
  268.         .ScaleWithDocHeaderFooter = True
  269.         .AlignMarginsHeaderFooter = True
  270.         .EvenPage.LeftHeader.Text = ""
  271.         .EvenPage.CenterHeader.Text = ""
  272.         .EvenPage.RightHeader.Text = ""
  273.         .EvenPage.LeftFooter.Text = ""
  274.         .EvenPage.CenterFooter.Text = ""
  275.         .EvenPage.RightFooter.Text = ""
  276.         .FirstPage.LeftHeader.Text = ""
  277.         .FirstPage.CenterHeader.Text = ""
  278.         .FirstPage.RightHeader.Text = ""
  279.         .FirstPage.LeftFooter.Text = ""
  280.         .FirstPage.CenterFooter.Text = ""
  281.         .FirstPage.RightFooter.Text = ""
  282.     End With
  283.     Application.PrintCommunication = True
  284.     Application.PrintCommunication = False
  285.     With ActiveSheet.PageSetup
  286.         .PrintTitleRows = ""
  287.         .PrintTitleColumns = ""
  288.     End With
  289.     Application.PrintCommunication = True
  290.     ActiveSheet.PageSetup.PrintArea = ""
  291.     Application.PrintCommunication = False
  292.     With ActiveSheet.PageSetup
  293.         .LeftHeader = ""
  294.         .CenterHeader = ""
  295.         .RightHeader = ""
  296.         .LeftFooter = ""
  297.         .CenterFooter = ""
  298.         .RightFooter = ""
  299.         .LeftMargin = Application.InchesToPoints(0.7)
  300.         .RightMargin = Application.InchesToPoints(0.7)
  301.         .TopMargin = Application.InchesToPoints(0.75)
  302.         .BottomMargin = Application.InchesToPoints(0.75)
  303.         .HeaderMargin = Application.InchesToPoints(0.3)
  304.         .FooterMargin = Application.InchesToPoints(0.3)
  305.         .PrintHeadings = False
  306.         .PrintGridlines = False
  307.         .PrintComments = xlPrintNoComments
  308.         .PrintQuality = 600
  309.         .CenterHorizontally = False
  310.         .CenterVertically = False
  311.         .Orientation = xlLandscape
  312.         .Draft = False
  313.         .PaperSize = xlPaperA4
  314.         .FirstPageNumber = xlAutomatic
  315.         .Order = xlDownThenOver
  316.         .BlackAndWhite = False
  317.         .Zoom = False
  318.         .FitToPagesWide = 1
  319.         .FitToPagesTall = 0
  320.         .PrintErrors = xlPrintErrorsDisplayed
  321.         .OddAndEvenPagesHeaderFooter = False
  322.         .DifferentFirstPageHeaderFooter = False
  323.         .ScaleWithDocHeaderFooter = True
  324.         .AlignMarginsHeaderFooter = True
  325.         .EvenPage.LeftHeader.Text = ""
  326.         .EvenPage.CenterHeader.Text = ""
  327.         .EvenPage.RightHeader.Text = ""
  328.         .EvenPage.LeftFooter.Text = ""
  329.         .EvenPage.CenterFooter.Text = ""
  330.         .EvenPage.RightFooter.Text = ""
  331.         .FirstPage.LeftHeader.Text = ""
  332.         .FirstPage.CenterHeader.Text = ""
  333.         .FirstPage.RightHeader.Text = ""
  334.         .FirstPage.LeftFooter.Text = ""
  335.         .FirstPage.CenterFooter.Text = ""
  336.         .FirstPage.RightFooter.Text = ""
  337.     End With
  338.     Application.PrintCommunication = True
  339. End Sub
  340.