アットウィキロゴ

sample > sheet-2

Sub ★選択範囲で印刷設定()

   With ActiveSheet.PageSetup
       .PrintArea = Selection.Address  '選択範囲が印刷範囲
       .CenterHeader = "&16&A"         '真ん中のヘッダー:16ポイントのシート名
       .RightHeader = "&12&D"          '右のヘッダー:12ポイントのToday
       .CenterFooter = "&P/&N"         '真ん中のフッター:11ポイントのページ連番
       .LeftMargin = Application.InchesToPoints(0.31496062992126)
       .RightMargin = Application.InchesToPoints(0.31496062992126)
       .TopMargin = Application.InchesToPoints(0.551181102362205)
       .BottomMargin = Application.InchesToPoints(0.354330708661417)
       .HeaderMargin = Application.InchesToPoints(0.196850393700787)
       .FooterMargin = Application.InchesToPoints(0.118110236220472)
       .CenterHorizontally = True      '左右中央
       .Orientation = xlPortrait       '印刷方向縦書き
       .Zoom = False                   '拡大/縮小の設定オフ
       .FitToPagesWide = 1             'ページ数を横1枚に
       .FitToPagesTall = 1             'ページ数を縦1枚に
   End With
  
   ActiveWindow.SelectedSheets.PrintPreview '印刷プレビュー表示

End Sub

Sub ★値貼り付け()
   'ショートカット割当:Ctrl+e
  
   Selection.PasteSpecial xlPasteValues
       '形式を選択して貼り付け-値で貼付

End Sub

Sub ★書式貼り付け()
   'ショートカット割当:Ctrl+t
  
   Selection.PasteSpecial xlPasteFormats
       '形式を選択して貼り付け-書式で貼付

End Sub

Sub ★数式貼り付け()
   'ショートカット割当:Ctrl+q
  
   Selection.PasteSpecial xlPasteFormulas
       '形式を選択して貼り付け-数式で貼付
  
End Sub

Sub ★行列を入れ替えて値貼り付け()
   'ショートカット割当:Ctrl+Shift+V
  
   Selection.PasteSpecial xlPasteValues, _
       Transpose:=True
       '形式を選択して貼り付け-値で貼付
       '行と列を入れ替える
End Sub

Sub ★コピー後右の列に値で貼付()
   'ショートカット割当:Ctrl+Shift+A
   
   Selection.Copy
   ActiveCell.Offset(0, 1).PasteSpecial xlPasteValues
       'アクティブセルの1セル右側に貼付
       '形式を選択して貼り付け-値で貼付
   Application.CutCopyMode = False
       'コピーのクリップボード解除
  
End Sub
最終更新:2011年08月02日 12:07