excel - Selecting first row/last row only from saved file to print -


i've completed code save data, export pdf, jazz. wondering if there way incorporate [excel sheet].pagesetup.printtitlerows = "$[firstrow]$[lastrow]"; program. i'm not sure if should manipulated in way. first row holds units , report saves data in each row, however, want last row of data (new stuff), unit row (row 1) well. here's code, not entirely sure put (proably near end):

sub save_history()        'copies data calculation page sheets("simple calculation").select      range("a2:i2").select          selection.copy              sheets("media history").select                  range("a" & rows.count).end(xlup).offset(1).select                      selection.pastespecial paste:=xlpastevalues, operation:=xlnone, skipblanks:=false, transpose:=false application.displayalerts = false`    ' check year folder , create if needed if len(dir("c:blah\" & year(date), vbdirectory)) = 0     mkdir "c:blah\" & year(date) end if    ' check month folder , create if needed if len(dir("c:blah\" & year(date) & "\" & monthname(month(date), false), vbdirectory)) = 0     mkdir "c:blah\" & year(date) & "\" & monthname(month(date), false) end if    ' check day folder , create if needed if len(dir("c:blah\" & year(date) & "\" & monthname(month(date), false) & "\" & day(date), vbdirectory)) = 0     mkdir "c:blah\" & year(date) & "\" & monthname(month(date), false) & "\" & day(date) end if   strfilepath = "c:blah\" & year(date) & "\" & monthname(month(date), false) & "\" & _               format(date, "mm.dd.yy") & "_" & format(time(), "hh.mm.ssam/pm") & ".pdf"  activesheet.exportasfixedformat type:=x1typepdf, filename:=strfilepath, _                                 quality:=x1qualitystandard, includedocproperties:=true, _                                 ignoreprintareas:=false, openafterpublish:=true _   application.displayalerts = true   ' popup message msgbox "file saved as:" & vbnewline & strfilepath  end sub 

here's worked (finally) copied/pasted again.

sub save_history() 

sheets("simple calculation").select

range("a2:i2").select      selection.copy          sheets("new media report").select              range("a1").end(xlup).offset(1).select                  selection.pastespecial paste:=xlpastevalues, operation:=xlnone, skipblanks:=false, transpose:=false 

'copies data calculation page sheets("simple calculation").select

range("a2:i2").select      selection.copy          sheets("media history").select              range("a" & rows.count).end(xlup).offset(1).select                  selection.pastespecial paste:=xlpastevalues, operation:=xlnone, skipblanks:=false, transpose:=false application.displayalerts = false   ' check year folder , create if needed 

if len(dir("c:blah\" & year(date), vbdirectory)) = 0 then mkdir "c:blah\" & year(date) end if

' check month folder , create if needed if len(dir("c:blah\" & year(date) & "\" & monthname(month(date), false), vbdirectory)) = 0 mkdir "c:blah\" & year(date) & "\" & monthname(month(date), false) end if

' check day folder , create if needed if len(dir("c:blah\" & year(date) & "\" & monthname(month(date), false) & "\" & day(date), vbdirectory)) = 0 mkdir "c:blah\" & year(date) & "\" & monthname(month(date), false) & "\" & day(date) end if

strfilepath = "c:blah\" & year(date) & "\" & monthname(month(date), false) & "\" & _ format(date, "mm.dd.yy") & "_" & format(time(), "hh.mm.ssam/pm") & ".pdf"

activesheet.exportasfixedformat type:=x1typepdf, filename:=strfilepath, _ quality:=x1qualitystandard, includedocproperties:=true, _ ignoreprintareas:=false, openafterpublish:=true _

application.displayalerts = true

' popup message msgbox "file saved as:" & vbnewline & strfilepath

end sub


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -