Export a worksheet range to csv using excel-vba -


i exporting excel csv macro using name file data in worksheet in cells in cells form no part of csv data, file name:

private sub commandbutton1_click() dim path string dim filename1 string dim filename2 string dim filename3 string path = "t:\richards reports\mg orders\" filename1 = range("a1") filename2 = range("o1") filename3 = range("m1") activeworkbook.saveas filename:=path & filename1 & "_" & filename2 & "_" &       filename3 & ".txt", fileformat:=xlcsv end sub 

however, need able limit output specific range, example cells i6 i60, struggling find way of accomplishing this, suggestions appreciated. tia duncan

here code save selected range .csv

sub saveselection2csv() dim range2save range dim filename range dim datarow range dim datarowarr() variant      set filename = worksheets("arkusz1").range("a1")      open thisworkbook.path & "\" & filename.value & ".csv" output #1      each datarow in selection.rows         datarowarr = datarow.value         datarowarr = application.transpose(application.transpose(datarowarr))         print #1, join(datarowarr, ",")     next      close #1 end sub 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -