2ちゃんねる ■掲示板に戻る■ 全部 1- 最新50    

Excel VBA 質問スレ Part80(ワッチョイあり)

52 :デフォルトの名無しさん :2024/04/09(火) 14:44:25.19 ID:EBugvdEwM.net
>>47
Sub 全自動で表を作るMacro1()
  Dim da As Date
  da = "1/1" 'この日からスタート
  ro = 2
  For we = 1 To 52 '52週間分作る
    Cells(ro, 3).Resize(1, 3) = Array("a", "b", "c")
    For lo = 1 To 7
      Cells(ro + lo, 2) = da
      da = da + 1
    Next
    Set ra = Cells(ro, 2).Resize(8, 4)
    ra.Borders(xlEdgeLeft).LineStyle = xlContinuous
    ra.Borders(xlEdgeLeft).Weight = xlMedium
    ra.Borders(xlEdgeRight).LineStyle = xlContinuous
    ra.Borders(xlEdgeRight).Weight = xlMedium
    ra.Borders(xlEdgeTop).LineStyle = xlContinuous
    ra.Borders(xlEdgeTop).Weight = xlMedium
    ra.Borders(xlEdgeBottom).LineStyle = xlContinuous
    ra.Borders(xlEdgeBottom).Weight = xlMedium
    ra.Borders(xlInsideVertical).LineStyle = xlContinuous
    ra.Borders(xlInsideVertical).Weight = xlMedium
    ra.Borders(xlInsideHorizontal).LineStyle = xlContinuous
    ra.Borders(xlInsideHorizontal).Weight = xlMedium
    ro = ro + 8
  Next
  Range("B:B").Font.Name = "MS 明朝"
  Range("C:E").Font.Name = "MS ゴシック"
  Range("B:E").Font.Bold = True
  Range("B:B").NumberFormatLocal = "m月d日 (aaa)"
End Sub

20 KB
新着レスの表示

掲示板に戻る 全部 前100 次100 最新50
名前: E-mail (省略可) :

read.cgi ver.24052200