2021-07-01から1ヶ月間の記事一覧

目次作成マクロ

Sub makeSheetsContent()'シート目次を作る Dim arr As Variant Dim ws As Worksheet Dim rng As Range Dim buf As String Dim i As Integer Dim wsNum As Integer Call appSet wsNum = Worksheets.Count 'シートの数。見出しも作成するために1加えておく Re…

シート表示マクロ

Sub TEST() Dim WsName(1 To 3) As Variant Dim flag As Long Dim i As Long WsName(1) = "Sheet3" WsName(2) = "Sheet8" WsName(3) = "Sheet6" Dim WS As Worksheet For Each WS In Worksheets flag = 0 For i = 1 To 3 If WS.Name = WsName(i) Then flag =…

エクセルマクロ 合計まるめ

Sub 工種合計まるめ() Dim b As Long Dim i As Long Dim k As Long For i = 2 To Cells(Rows.Count, 1).End(xlUp).Row If Cells(i, 1) <> "" Then Cells(i, 4) = WorksheetFunction.Sum(Range("F" & i, "J" & i)) b = Range("B" & i).Value k = -(Log(b) / L…

空白セルを消去上詰め、段落分け、列を挿入

Sub 空白行を上詰め() Selection.SpecialCells(xlCellTypeBlanks).Select Selection.Delete Shift:=xlUp End Sub Sub 整理() Selection.CurrentRegion.SpecialCells(xlCellTypeBlanks).Delete Shift:=xlUp Columns("B:C").Insert Dim i As Long For i = 1 To…

段を挙げてそろえるマクロコード

段を挙げてそろえるマクロコード Sub ex() Dim i As Long Dim j As Long Application.ScreenUpdating = False If Cells(3, 3) <> "" Then Exit Sub For i = 3 To Cells(Rows.Count, 1).End(xlUp).Row If Cells(i, 1) <> "" Then For j = 3 To 4 Cells(i, j) …