Page 1 of 1 1
Topic Options
#93091 - 2003-10-10 06:39 PM Problems with advanced Excel funcionality
Jakob Bindslet Offline
Lurker

Registered: 2003-07-23
Posts: 4
Loc: Denmark
Hi Everybody

I'm writing (yet another) poor man's data collection engine using kix, and MS Excel (for presentation). Unfortunately I have run into some difficulties with my dynamically generated excel worksheets.

My code is quite capable of creating, and entering data into an excel document, but when it comes to functions, I can't quite get it to work.

A simple function, like "countif" simply results in no data entering the target cell.

Any help would be greatly welcomed !!!

-
Jakob

CODE EXAMPLE (look at cell B10 & C10):
$OutputFile = "C:\Output.xls"

$app = CreateObject("Excel.Application")
$wbs = $app.Workbooks
$null = $wbs.Add
$worksheet1 = $wbs.Item(1).Worksheets.Item(1)

$worksheet1.Range(B2:B9).Formula = 'Jimmy'
$worksheet1.Range(C2:C9).Formula = '6'
$worksheet1.Range(B10).Formula = '=COUNTIF(B2:B9;"Jimmy")'
$worksheet1.Range(C10).Formula = '=SUM(B2:B9)'

$wbs.Item(1).SaveAs("$OutputFile")
$wbs.Close
$worksheet1 = 0
$worksheet2 = 0
$wbs = 0
$app = 0

RUN "CMD.EXE /C " + $OutputFile
_________________________
---ooo00ooo--- Jakob Bindslet

Top
#93092 - 2003-10-10 10:27 PM Re: Problems with advanced Excel funcionality
Stevie Offline
Starting to like KiXtart
*****

Registered: 2002-01-09
Posts: 199
Two problems:

1.
code:
$worksheet1.Range(C10).Formula = '=SUM(B2:B9)'

should be
code:
 $worksheet1.Range(C10).Formula = '=SUM(C2:C9)' 

2. Your COUNTIF syntax is incorrect:
code:
'=COUNTIF(B2:B9;"Jimmy")'

should be
code:
'=COUNTIF(B2:B9,"Jimmy")'

If it detects an error in the formula, it will not apply the formula to the cell.
_________________________
Stevie

Top
#93093 - 2003-10-11 12:28 AM Re: Problems with advanced Excel funcionality
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
wonder why you don't do the formula in kix. read stuff, rock it, bastafy it and write to result field.
_________________________
!

download KiXnet

Top
#93094 - 2003-10-11 02:08 AM Re: Problems with advanced Excel funcionality
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
bastify it - lol
Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.053 seconds in which 0.026 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org