Export sheet as new Excel file (values only) -
i found code in discussion has been extremely helpful exporting excel sheets new workbook. i've posted version of code use below.
as code stands, copies content of desired sheet new workbook, formulas , all.
is possible modify code copy values new workbook?
i appreciate insight can lend.
sub exportxlsx() 'exports desired sheet new xlsx file dim mypath string dim myfilename string dim datestring string datestring = format(now(), "yyyy-mm-dd_hh_mm_ss_am/pm") myfilename = datestring & "_" & "whatever like" if not right(myfilename, 4) = ".xlsx" myfilename = myfilename & ".xlsx" sheets("desired sheet").copy application.filedialog(msofiledialogfolderpicker) .title = "where should save this?" .allowmultiselect = false .initialfilename = "" '<~~ start folder path file picker. if .show <> -1 goto nextcode mypath = .selecteditems(1) & "\" end nextcode: activeworkbook .saveas filename:=mypath & myfilename, fileformat:=xlopenxmlworkbook, createbackup:=false .close false end end sub
see revised nextcode section solution:
nextcode: activeworkbook .activesheet.usedrange.value = activesheet.usedrange.value '<~~ converts contents of xlsx file values .saveas filename:=mypath & myfilename, fileformat:=xlopenxmlworkbook, createbackup:=false .close false end
Comments
Post a Comment