Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.
Round(Sheet2.Cells(x, 14).Value, 2)
If Sheet2.Cells(x, 8).Value <> 0 Then
y = x - 3
Sheets(y).Select
ActiveSheet.PageSetup.PrintArea = "$B$2:$F$21"
ActiveWindow.SelectedSheets.PrintOut Copies:=1
End If
If Sheet2.Cells(x, 8).Value <> 0 Then
y = x - 3
With Sheets(y)
.PageSetup.PrintArea = "$B$2:$F$21"
.PrintOut copies:=1
End With
End If
Sub test()
Dim wkb As Workbook
Dim wksNew As Worksheet
Dim outCursor As Range
Set wkb = ThisWorkbook
On Error Resume Next
Set wksNew = wkb.Worksheets("Log Sheet")
If Err.Number <> 0 Then
Set wksNew = wkb.Worksheets.Add(after:=wkb.Worksheets(wkb.Worksheets.Count))
wksNew.Name = "Log Sheet"
End If
On Error GoTo 0
wksNew.Cells.Clear
Set outCursor = wksNew.Range("A1")
For x = 6 To 19
outCursor.Value = "BLOCK 1 Sheet2.Cells(" & x & ",8).Address is = " & Sheet2.Cells(x, 8).Address & " having value: " & Sheet2.Cells(x, 8).Value
Set outCursor = outCursor.Offset(1, 0)
If Sheet2.Cells(x, 8).Value <> 0 Then
y = x - 3
With Sheets(y)
.PageSetup.PrintArea = "$B$2:$F$21"
.PrintOut Copies:=1
End With
End If
Next x
For x = 6 To 19
outCursor.Value = "BLOCK 2 Sheet2.Cells(" & x & ",11).Address is = " & Sheet2.Cells(x, 11).Address & " having value: " & Sheet2.Cells(x, 11).Value
Set outCursor = outCursor.Offset(1, 0)
If Sheet2.Cells(x, 11).Value <> 0 Then
y = x - 3
With Sheets(y)
.PageSetup.PrintArea = "$I$2:$M$21"
.PrintOut Copies:=1
End With
End If
Next x
For x = 6 To 19
outCursor.Value = "BLOCK 3 Sheet2.Cells(" & x & ",14).Address is = " & Sheet2.Cells(x, 14).Address & " having value: " & Sheet2.Cells(x, 14).Value
Set outCursor = outCursor.Offset(1, 0)
If Sheet2.Cells(x, 14).Value <> 0 Then
y = x - 3
With Sheets(y)
.PageSetup.PrintArea = "$b$22:$f$41"
.PrintOut Copies:=1
End With
End If
Next x
For x = 26 To 39
outCursor.Value = "BLOCK 4 Sheet2.Cells(" & x & ",14).Address is = " & Sheet2.Cells(x, 14).Address & " having value: " & Sheet2.Cells(x, 14).Value
Set outCursor = outCursor.Offset(1, 0)
If Sheet2.Cells(x, 14).Value <> 0 Then
y = x - 23
With Sheets(y)
.PageSetup.PrintArea = "$I$22:$M$41"
.PrintOut Copies:=1
End With
End If
Next x
End Sub
If you are experiencing a similar issue, please ask a related question
Title | # Comments | Views | Activity |
---|---|---|---|
Select only certain columns not entire sheet | 12 | 27 | |
Excel VBA | 10 | 39 | |
locking multiple column ranges | 10 | 23 | |
Excel Charts: How is this Chart made? | 8 | 24 |
Join the community of 500,000 technology professionals and ask your questions.