Hi all,

I'm fairly new to VBA but was enlisted with a task to help work out, recently. With a bit of assistance from people who knew a lot more than me, we've been able to muster up a working document, but I require a 'checkbox / comments box' at the bottom of every finished document - we're printing up to 300 of these a day.

I've come across some code that should work to allow it to only print on the final page;

[vba]Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
If TotPages > 1 Then
With ActiveSheet.PageSetup
.CentreFooter = ""
ActiveSheet.PrintOut From:=1, To:=TotPages - 1
.CentreFooter = Range("").Value
ActiveSheet.PrintOut From:=TotPages, To:=TotPages
End With
End If
End Sub[/vba]

However, this doesn't seem to let me pull from sheet4 using the code I was trying.

Here's the current loop we're using to pull the data from another spreadsheet

[vba]Sub GetData()
sr = 2 'start row source
cc = 14 'no of columns to copy from source
dr = 11
source_file = ActiveWorkbook.Path & "\" & "filename.xls"
Sheet1.Select 'MAKE SURE YOU SELECT DESTINATION BEFORE RUNNING!!!!
dest_sheet = ActiveWorkbook.Name
If Dir(source_file) = "" Then
MsgBox "Cant find source file?" & vbCr & vbCr & source_file _
& vbCr & vbCr & "Will use Sheet2 as source instead"
Set ws = Worksheets("Sheet2")
Else
Workbooks.Open source_file 'load source workbook - YOU DONT HAVE TO!!!
Set wb = Workbooks(ActiveWorkbook.Name)
Set ws = wb.Worksheets(1)
End If
Workbooks(dest_sheet).Activate
clearrow = dr
Do 'clear content
Rows(clearrow).Clear
clearrow = clearrow + 1
Loop Until Cells(clearrow, 1) = ""
'Stop 'to debug
Application.ScreenUpdating = False 'speeds up code!
Do 'copy content from sheet2
For i = 1 To cc
Cells(dr, i) = ws.Cells(sr, i)
Cells(dr, i).Borders.LineStyle = xlContinuous
Next i
sr = sr + 1
dr = dr + 1
Loop Until ws.Cells(sr, 1) = ""
Set ws = Nothing
On Error Resume Next 'stops error on wb.close if using sheet2
wb.Close 'close source file
Set wb = Nothing
Application.ScreenUpdating = True

Sheets("Sheet1").Range("I2:J3").ClearContents 'Clears Cell I1 Customer upon import

End Sub
[/vba]

Any insight on how I can pull the data from Sheet4?

I've also tried doing it as an image (attached image in case there is an alternative suggestion based on the fact it's a table)

Thanks in advance.

i.imgur.com/GwzbrZA.png