Hi
First post, so here goes:
I have a spreadsheet with 20 columns, and need to copy these rows of data (ie without the header rows) into a new sheet, and then save as a csv file.
Several columns have formulas, and the last 3 columns often will not contain any data in them at all.
Regardless of whether or not there is data in the cells, I need all 20 columns (fields) to be exported to the csv file, to be used for importing to a database - so I need to have all 20 fields.
I have worked out the VB code to select and copy the correct range, paste it to a new worksheet, and then save the new worksheet as a csv file.
But here is my problem:
If I use "Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone, SkipBlanks:=False, Transpose:=False", then it will copy accross all 20 fields correctly (including the blank ones at the end), as it copies 'ALL', althogh it does copy all 20 fields, it will copy accross the FORUMLAS, and not the data which is what I want.
So then I tried "Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False", thinking that if I used Paste:=xlPasteValues it should work.
Well, now it does copy the 'data' and not the formulas, but I am only getting accross the 17 columns worth, (as the last three are blank). :-(
I have checked that the option 'SkipBlanks' is set to false, and I also tried removing this altogether.
Any ideas or help?
I am running Office 2003.
Thanks in advance...
Eli
First post, so here goes:
I have a spreadsheet with 20 columns, and need to copy these rows of data (ie without the header rows) into a new sheet, and then save as a csv file.
Several columns have formulas, and the last 3 columns often will not contain any data in them at all.
Regardless of whether or not there is data in the cells, I need all 20 columns (fields) to be exported to the csv file, to be used for importing to a database - so I need to have all 20 fields.
I have worked out the VB code to select and copy the correct range, paste it to a new worksheet, and then save the new worksheet as a csv file.
But here is my problem:
If I use "Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone, SkipBlanks:=False, Transpose:=False", then it will copy accross all 20 fields correctly (including the blank ones at the end), as it copies 'ALL', althogh it does copy all 20 fields, it will copy accross the FORUMLAS, and not the data which is what I want.
So then I tried "Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False", thinking that if I used Paste:=xlPasteValues it should work.
Well, now it does copy the 'data' and not the formulas, but I am only getting accross the 17 columns worth, (as the last three are blank). :-(
I have checked that the option 'SkipBlanks' is set to false, and I also tried removing this altogether.
Any ideas or help?
I am running Office 2003.
Thanks in advance...
Eli