Excel copy columns

Hi everyone,

I have searched high and low on the web and on this forum and can’t quite come up with the solution to my problem.

I have a spreadsheet 500 columns and each column has 60+ rows.

What I’m trying to do is copy each column’s content and create a text file of it, saved with the name of the value in the 1st cell of the column.

So for example

A B C D < column
1 1 1 1 < first value, which becomes the filename per column, firstvalue.txt
2 2 2 2
3 3 3 3

After it does column A, it should move on to column B and perform the same function, etc.

Can anyone help me figure this out?

This is as far as I’ve gotten:

tell application "Microsoft Excel"
	activate
	tell active sheet to set myData to value of used range
	set myRow to 1
	set myCol to 25
	set myVal to item {myCol} of item {myRow} of myData
	
	
	tell application "System Events" to keystroke "c" using {command down}
	tell me to activate
	set selecTxt to the clipboard as text
	
	
	set myFile to open for access (path to desktop as text) & myVal & ".txt" with write permission
	write selecTxt to myFile
	close access myFile
	
end tell

Clearly the problem with the above is that it requires me to manually update the myRow and myColumn, and I basically have to click on the column I want it to process. Not very automated…

Thank you in advance for your help!

Manish

hi
Here is a start to your script

tell application "Microsoft Excel"
	activate
	set usedrange to range (get address of used range of active sheet) of active sheet
	repeat with colNum from 1 to count of columns of usedrange
		set copyrange to cell colNum of range "1:1"
	end repeat
end tell

bills