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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Functions in OLE??

Status
Not open for further replies.

ctodd

Programmer
Apr 26, 2000
1
US
Hi, <br>I'm trying to utilize the CountA() function of Excel thru my VB application. For some reason I can't get the syntax right. I need to ount the number of cells what have something in them.(data, strings, etc).<br>Here's what I have so far: <br>Public Sub UpdateExcel()<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim Range As String<br>&nbsp;&nbsp;&nbsp;&nbsp;Rang = &quot;C1:C99&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;AppExcel.ActiveCell.FormulaR1C1 = &quot;=counta(rang)&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;'Here's where I'm having the trouble..any<br>&nbsp;&nbsp;&nbsp;&nbsp;'TIPS??<br>&nbsp;&nbsp;&nbsp;&nbsp;row1 = AppExcel.ActiveCell.Value<br>&nbsp;&nbsp;&nbsp;&nbsp;row1 = row1 + 1<br>&nbsp;&nbsp;&nbsp;&nbsp;Rng = &quot;a&quot; & row1<br>&nbsp;&nbsp;&nbsp;&nbsp;AppExcel.Range(Rng).Select<br>&nbsp;&nbsp;&nbsp;&nbsp;AppExcel.ActiveCell.FormulaR1C1 = Date<br>&nbsp;&nbsp;&nbsp;&nbsp;AppExcel.Selection.NumberFormat = &quot;d-mmm-yy&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;Rng1 = &quot;b&quot; & row1<br>&nbsp;&nbsp;&nbsp;&nbsp;AppExcel.Range(Rng1).Select<br>&nbsp;&nbsp;&nbsp;&nbsp;AppExcel.ActiveCell.FormulaR1C1 = Time<br>&nbsp;&nbsp;&nbsp;&nbsp;AppExcel.Selection.NumberFormat = &quot;h:mm&quot;<br>End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top