473,946 Members | 11,616 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Add a cell formula in Excel via vba from access

I wish basically to put the following formula into cell L6 in an excel
spreadsheet.=CO UNTIF(L6:L1025, "Yes").

I have tried the following code and it wont compile. the colon : is
unacceptable.
xl.ActiveCell.V alue =COUNTIF(L6:L10 25,"Yes")

In fact, I have 3 different formulae, I want to do this with, but each fails
on the colon.

Can anyone please help me with the syntax for doing this?

dixie
Nov 13 '05 #1
3 10382
Remember that you're actually trying to put literal text into the cell. You
need quotes around what you're assigning.

Try

xl.ActiveCell.V alue = "=COUNTIF(L6:L1 025,""Yes"")"

Note the doubling up of quotes inside the string to result in quotes around
Yes, and the inclusion of the = sign in the quotes.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Dixie" <di***@dogmail. com> wrote in message
news:43******** @duster.adelaid e.on.net...
I wish basically to put the following formula into cell L6 in an excel
spreadsheet.=C OUNTIF(L6:L1025 ,"Yes").

I have tried the following code and it wont compile. the colon : is
unacceptable.
xl.ActiveCell.V alue =COUNTIF(L6:L10 25,"Yes")

In fact, I have 3 different formulae, I want to do this with, but each
fails on the colon.

Can anyone please help me with the syntax for doing this?

dixie

Nov 13 '05 #2

You should be asking this in an Excel newsgroup, but the syntax should
be something like:

xl.ActiveCell.F ormula = "COUNTIF(L6:L10 25,""Yes"")"
On Sun, 25 Sep 2005 20:20:44 +1000, "Dixie" <di***@dogmail. com> wrote:
I wish basically to put the following formula into cell L6 in an excel
spreadsheet.=C OUNTIF(L6:L1025 ,"Yes").
I have tried the following code and it wont compile. the colon : is
unacceptable .
xl.ActiveCell. Value =COUNTIF(L6:L10 25,"Yes")
In fact, I have 3 different formulae, I want to do this with, but each fails
on the colon.
Can anyone please help me with the syntax for doing this?

--
Drive C: Error. (A)bort (R)etry (S)mack The Darned Thing

Nov 13 '05 #3
Ah, that is how it is done. Thanks Douglas, most helpful.

dixie

"Douglas J. Steele" <NOSPAM_djsteel e@NOSPAM_canada .com> wrote in message
news:If******** *************** *******@rogers. com...
Remember that you're actually trying to put literal text into the cell.
You need quotes around what you're assigning.

Try

xl.ActiveCell.V alue = "=COUNTIF(L6:L1 025,""Yes"")"

Note the doubling up of quotes inside the string to result in quotes
around Yes, and the inclusion of the = sign in the quotes.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Dixie" <di***@dogmail. com> wrote in message
news:43******** @duster.adelaid e.on.net...
I wish basically to put the following formula into cell L6 in an excel
spreadsheet.= COUNTIF(L6:L102 5,"Yes").

I have tried the following code and it wont compile. the colon : is
unacceptable.
xl.ActiveCell.V alue =COUNTIF(L6:L10 25,"Yes")

In fact, I have 3 different formulae, I want to do this with, but each
fails on the colon.

Can anyone please help me with the syntax for doing this?

dixie


Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3733
by: jack | last post by:
I'm using VBA for Excel and would like to do the following: 1) in sheet1, search for a value which is given in a specific cell location on sheet2. 2) when i find that value in sheet1, i want to insert in the cell immediately to the right of the active cell a formula which includes a reference to a fixed cell location from sheet2 3) then i want to do the same search again in sheet1, this time using the
5
7241
by: Mads Petersen | last post by:
Hi, and thanks for previous help. I use following code to export from excel to access. It is executed in excel. I have an excel spreadsheet with one sheet pr. week. this code is therefore executed on every sheet, and is supposed to be it on comming sheets as well. Therefore I would very much like if I could check if the value in A98 (excel) matches a record in the access table TimeReview, field "Uge". And if it does the export should be...
5
12208
by: nedian | last post by:
Hello I am student and trying to learn access.I am having problem in making a program can any one help me? i wanted to make 2 tables in access and then create a link.First i am telling u what these tables contain then i will proceed. (i have also tried this in excel but failed to do so). table 1 (contains following items)
1
5518
by: MAdcock | last post by:
I have been having major problems trying to write a piece of code to basically tally (add) values in a table (column B) that have the same product name (column A). The problem is that the table is variable (produced from another macro) and so this needs to be taken into account. To solve the problem it could be performed through using the product name to know which values to add OR as I have already got another column(E) that has a count of...
1
1337
by: Brian Lundell | last post by:
Hi. My name is Brian Lundell. I am not a programmer, but very interested. I am creating a program for keeping track of Service Requests at work and am trying to find a way to automate creating a certain segment of code. The problem is as follows: I have created two worksheets in Excel. Cell G1 in the first needs to contain a formula to equal Cell A6 in the second. Cell G6 in the first needs to contain a formula to equal Cell A61 in the...
0
1873
by: suresh_punniyakkodi | last post by:
Hellow Friends, I have one doubt, please help me... In Excel, i have lot of rows and coloumns, i need to read all cell values with in rows and coloumn limit... At the time of read data from excel, Invalid use of Null error came... In that current cell have an '#VALUE!" -> that means illegal value... I need to read same '#VALUE!"(exact cell value from excel)... #VALUE! -> means, formula error... But, i need to read...
0
837
by: deve8ore | last post by:
Hello, I don't know if this can be done via Excel formula, or VBA, but I have an if statement in one column that will return the number "1" if the condition is true. I.e. J10 = 1 as C10 is true to the condition. I'm importing the cell C10 so it's always changing, so a formula would be wiped out, however if J10 is true (and equal to "1"), I'd like C10 to read "TOTAL". Hopefully this makes sense. I was thinking of placing some sort...
1
11079
by: Monusonu | last post by:
Hi Expert, I am trying to get the value from excel formula cell using POI. My code works fine for less complex formula cells, but fails or returns error code for complex formula cells. Following is the code I am using to get values:- public class POIMain{ public POIMain() { } public static void main(String args) { try{
2
5563
by: rtilson | last post by:
I am not sure why excel and access use the same method in formula. I am not access expert but been trying to figure it out. Here is the excel formula that I would like to use in access expression =ROUND((A2-5148000)*1.000440935+48000,IF(MOD(A2,1)=0,0,3)) I have tried using is the coorinate
0
9975
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11142
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11325
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9873
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8240
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7404
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6097
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4525
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.