VBA CSV file has missing data from excel formula -
i learning vba , have come across problem data formula blank in created csv file.
i have macro updates data , runs solver solution , store result set csv file further processing. works exception numeric data not pasted csv. missing data calculated via formula, have tested manually entered data , works. have tried using pastespecial xlpastevalues error
run time error '1004': application-defined or object-defined error
private sub cmdsave() dim sfilename string dim wb workbook application.displayalerts = false sfilename = "photorunplan.csv" 'copy contents of required sheet ready paste new csv sheets(1).range("runplan").copy 'define own range 'open new xls workbook, save file name set wb = workbooks.add wb .title = "mytitle" .subject = "mysubject" .sheets(1).select activesheet.pastespecial xlpastevalues .saveas "c:\users\rtovey1\documents\1401 - photo optimiser\runplan\" & sfilename, xlcsv .close end application.displayalerts = true end sub
thanks in advance
rob
you don't use
activesheet.pastespecial xlpastevalues
but use range, example:
.sheets(1).range("a1:z1000").pastespecial paste:=xlpastevalues
Comments
Post a Comment