Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

writing formula into the spreadsheet

Status
Not open for further replies.

ahau

Programmer
Apr 19, 2006
51
AU
Hi,

I was wondering if anyone might be able to help me on this. I would like to be able to read data from one file (e.g. .csv file) and write to another spreadsheet as well as being able to put in some formula into the field. My problem here is for example in that csv file, there are some fields containing formulas such as, in C12 = sum(C1:C11) or other formula. I think i need to write some codes there but don't know how. So my question is if that's possible to put in the formulas in the process of transfering data across.

I hope i explain it well.

Thank you in advance
 
You can create separate text file with formulas. For an exported range use SpecialCells method with type = xlCellTypeFormulas to get cells with formulas, for each cell use Address property for address, Formula property to get formula string.
Anyway, instead of using intermediate fornat, it is easier to create excel file with the only data and formulas you want to distribute.

combo
 
Hi Combo,

Thank you for your reply.

However, i need to know if there is some tips out there that can help me write VB codes to open a CSV file and write its content line by line or cells by cells to another spreadsheet. I'd really appreciate your help as this is my first time writing codes in excel.

I just know the basic codes to open a file but don't know how to read and write to another spreadsheet.

Thank you for your patience in advance
 
just open the csv file in excel - no need to write one line at a time - will do it in 1 go

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top