[[20081117184110]] 『エクセルのシートをもうひとつ増やして、従来の一括印刷ボタンで印刷したい。』  ページの最後に飛ぶ

[ 初めての方へ | 一覧(最新更新順) | 全文検索 | 過去ログ ]

 

『エクセルのシートをもうひとつ増やして、従来の一括印刷ボタンで印刷したい。』
 以下のマクロを使用しているのですが、
 自分がマクロを組んだのではないのでいまいち内容を理解していません。
 ですので、印刷するものに、新たなシートをもう一つ増やして
 一括印刷するにはどうしたらよいでしょうか?
 よろしくお願いします。

 Sub 印刷()
'
'印刷 Macro
'マクロ記録日:2008/11/17 ユーザー名:daiei-3
'

'
UserForm2.Show
If MsgBox("マクロがウイルス感染している可能性があります。印刷を続行しますか?", vbYesNo + vbCritical, "セキュリティ警告") = vbYes Then

     はっちゃけ度

  If MsgBox("入力事項を全部入力しましたか?", vbYesNo + vbQuestion, "印刷確認") = vbYes Then
     UserForm1.Show
     Sheets("表紙").Select
  Else
     MsgBox "チェックし直して、顔を洗って出直してこい。スットコドッコイ\(>_<)/", vbCritical
  End If
Else
     MsgBox "ウイルス感染なんかしていないよ〜だ。", vbCritical
End If

End Sub
Sub 残土処分部分印刷()
'
'
Sheets("残土処分").Select

  If Range("AH5") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1, Collate:=True
  End If

  If Range("AH58") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=2, To:=2, Copies:=1, Collate:=True
  End If

  If Range("AH111") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=3, To:=3, Copies:=1, Collate:=True
  End If

  If Range("AH164") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=4, To:=4, Copies:=1, Collate:=True
  End If

  If Range("AH217") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=5, To:=5, Copies:=1, Collate:=True
  End If

  If Range("AH270") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=6, To:=6, Copies:=1, Collate:=True
  End If

  If Range("AH323") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=7, To:=7, Copies:=1, Collate:=True
  End If

  If Range("AH376") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=8, To:=8, Copies:=1, Collate:=True
  End If

End Sub
Sub 単価内訳部分印刷()
'
'
Sheets("単価内訳一覧").Select

  If Range("Z5") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1, Collate:=True
  End If

  If Range("Z44") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=2, To:=2, Copies:=1, Collate:=True
  End If

  If Range("Z83") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=3, To:=3, Copies:=1, Collate:=True
  End If

  If Range("Z122") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=4, To:=4, Copies:=1, Collate:=True
  End If

  If Range("Z161") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=5, To:=5, Copies:=1, Collate:=True
  End If

  If Range("Z200") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=6, To:=6, Copies:=1, Collate:=True
  End If

  If Range("Z239") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=7, To:=7, Copies:=1, Collate:=True
  End If

  If Range("Z278") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=8, To:=8, Copies:=1, Collate:=True
  End If

  If Range("Z317") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=9, To:=9, Copies:=1, Collate:=True
  End If

  If Range("Z356") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=10, To:=10, Copies:=1, Collate:=True
  End If

  If Range("Z395") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=11, To:=11, Copies:=1, Collate:=True
  End If

  If Range("Z434") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=12, To:=12, Copies:=1, Collate:=True
  End If

  If Range("Z473") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=13, To:=13, Copies:=1, Collate:=True
  End If

  If Range("Z512") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=14, To:=14, Copies:=1, Collate:=True
  End If

  If Range("Z551") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=15, To:=15, Copies:=1, Collate:=True
  End If

  If Range("Z590") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=16, To:=16, Copies:=1, Collate:=True
  End If

  If Range("Z629") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=17, To:=17, Copies:=1, Collate:=True
  End If

  If Range("Z668") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=18, To:=18, Copies:=1, Collate:=True
  End If

  If Range("Z707") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=19, To:=19, Copies:=1, Collate:=True
  End If

  If Range("Z746") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=20, To:=20, Copies:=1, Collate:=True
  End If

  If Range("Z785") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=21, To:=21, Copies:=1, Collate:=True
  End If

  If Range("Z824") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=22, To:=22, Copies:=1, Collate:=True
  End If

  If Range("Z863") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=23, To:=23, Copies:=1, Collate:=True
  End If

  If Range("Z902") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=24, To:=24, Copies:=1, Collate:=True
  End If

  If Range("Z941") = 1 Then
     ActiveWindow.SelectedSheets.PrintOut From:=25, To:=25, Copies:=1, Collate:=True
  End If

End Sub
Sub 単価表印刷()
'
'
Sheets("単価表").Select

  Select Case Range("M5")
    Case Is = 1
      ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1, Collate:=True
    Case Is = 2
      ActiveWindow.SelectedSheets.PrintOut From:=1, To:=2, Copies:=1, Collate:=True
    Case Is = 3
      ActiveWindow.SelectedSheets.PrintOut From:=1, To:=3, Copies:=1, Collate:=True
    Case Is = 4
      ActiveWindow.SelectedSheets.PrintOut From:=1, To:=4, Copies:=1, Collate:=True
    Case Is = 5
      ActiveWindow.SelectedSheets.PrintOut From:=1, To:=5, Copies:=1, Collate:=True
    Case Is = 6
      ActiveWindow.SelectedSheets.PrintOut From:=1, To:=6, Copies:=1, Collate:=True
    Case Is = 7
      ActiveWindow.SelectedSheets.PrintOut From:=1, To:=7, Copies:=1, Collate:=True
    Case Is = 8
      ActiveWindow.SelectedSheets.PrintOut From:=1, To:=8, Copies:=1, Collate:=True
    Case Is = 9
      ActiveWindow.SelectedSheets.PrintOut From:=1, To:=9, Copies:=1, Collate:=True
    Case Is = 10
      ActiveWindow.SelectedSheets.PrintOut From:=1, To:=10, Copies:=1, Collate:=True
    Case Is = 11
      ActiveWindow.SelectedSheets.PrintOut From:=1, To:=11, Copies:=1, Collate:=True
    Case Is = 12
      ActiveWindow.SelectedSheets.PrintOut From:=1, To:=12, Copies:=1, Collate:=True
    Case Is = 13
      ActiveWindow.SelectedSheets.PrintOut From:=1, To:=13, Copies:=1, Collate:=True
    Case Else
      Sheets("表紙").Select
    End Select

End Sub
Sub 残土全印刷()
'
'印刷 Macro
'マクロ記録日:2008/11/17 ユーザー名:daiei-3
'

'

  If MsgBox("本当に全部印刷しますか?資源を大切にしよう。", vbYesNo + vbQuestion, "印刷確認") = vbYes Then
    If MsgBox("プリンターを変更しますか。?", vbYesNo + vbQuestion, "出力先確認") = vbYes Then
        Sheets("残土処分").Select
        Application.Dialogs(xlDialogPrint).Show arg1:=2, arg2:=1, arg3:=8
    Else
        Worksheets("残土処分").PrintOut Copies:=1, Collate:=True
    End If

    Sheets("表紙").Select

  Else
     MsgBox "地球環境に優しい取り組みだよ。", vbCritical
  End If

End Sub
Sub 単価内訳一覧全印刷()
'
'印刷 Macro
'マクロ記録日:2008/11/17 ユーザー名:daiei-3
'

'

  If MsgBox("本当に全部印刷しますか?よ〜く考えよう。もったいない!!", vbYesNo + vbQuestion, "印刷確認") = vbYes Then
    If MsgBox("プリンターを変更しますか。?", vbYesNo + vbQuestion, "出力先確認") = vbYes Then
        Sheets("単価内訳一覧").Select
        Application.Dialogs(xlDialogPrint).Show arg1:=2, arg2:=1, arg3:=8
    Else
        Worksheets("単価内訳一覧").PrintOut Copies:=1, Collate:=True
    End If

    Sheets("表紙").Select

  Else
     MsgBox "よく思い留まったね。あんたはえらい!!", vbCritical
  End If

End Sub
Sub はっちゃけ度()
'
'印刷 Macro
'マクロ記録日:2008/11/17 ユーザー名:daiei-3
'
Dim Iuck As Integer
Iuck = Int((6 * Rnd) + 1)
Select Case Iuck

   Case 1
      MsgBox "今日のはっちゃけ度は『セクキャバ湯川部長級(大興奮)』です。", , "はっちゃけ度"
   Case 2
      MsgBox "今日のはっちゃけ度は『めんそーれ川原級(何そーれ)』です。", , "はっちゃけ度"
   Case 3
      MsgBox "今日のはっちゃけ度は『ダンディズム田中級(輝いてます)』です。", , "はっちゃけ度"
   Case 4
      MsgBox "今日のはっちゃけ度は『牧野リターン級(ついつい)』です。", , "はっちゃけ度"
   Case 5
      MsgBox "今日のはっちゃけ度は『花びら2回転松島級(回数で勝負)』です。", , "はっちゃけ度"
   Case 6
      MsgBox "今日のはっちゃけ度は『結婚したい湯淺級(悩んでます)』です。", , "はっちゃけ度"
End Select

End Sub

(sathi)


 ご質問の意味が分からないんで回答ではありまへんが
 ↑のコードをこんな塩梅に纏める事がでけます。

 '--------------------------
 Sub 残土処分部分印刷() ' '
    Dim i As Long
    Sheets("残土処分").Select
    For i = 1 To 8
        If Range("AH" & IIf(i = 1, 5, i * 53 + 5)) = 1 Then
            ActiveWindow.SelectedSheets.PrintOut from:=i, to:=i, copies:=1, collate:=True
        End If
    Next i
 End Sub
 Sub 単価内訳部分印刷() ' '
    Dim i As Long
    Sheets("単価内訳一覧").Select
    For i = 1 To 25
        If Range("Z" & IIf(i = 1, 5, (i - 1) * 39 + 5)) = 1 Then
            ActiveWindow.SelectedSheets.PrintOut from:=i, to:=i, copies:=1, collate:=True
        End If
    Next i
 End Sub
 Sub 単価表印刷() ' '
    Dim i As Long, flg As Boolean
    Sheets("単価表").Select
    For i = 1 To 13
        If Range("M5") = i Then
            ActiveWindow.SelectedSheets.PrintOut from:=1, to:=i, copies:=1, collate:=True
            flg = True
            Exit For
         End If
    Next i
    If Not flag Then Sheets("表紙").Select
 End Sub


ありがとうございます。ためしてみます!
(SATHI)

コメント返信:

[ 一覧(最新更新順) ]


YukiWiki 1.6.7 Copyright (C) 2000,2001 by Hiroshi Yuki. Modified by kazu.