473,405 Members | 2,294 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Access to Exel creating variable formula

Hello I am sending data from access 2003 to Excel I then want to create a total sum for the data I have sent I can manage this if the data length is always the same length which it is not this worked when the data is the same

With gm_oExcelSheet.Rows(gCurrentExcelRow)
.Cells(, 7).value = "=SUM(R[-4]C:R[-1]C)"
End With

I then tried adding variables gStartRow as long and gEndRow as long. I have tried men variations on this but it is as if the variables do not work in the sum line

With gm_oExcelSheet.Rows(gCurrentExcelRow)
.Cells(, 7).ActiveCell.value = "=SUM(R[gStartRow]C:R[gEndRow]C)"
.Cells(, 7).value = "=SUM(R[gStartRow]C:R[gEndRow]C)"
End With

also tried it on its own gm_oExcel is my variable
Global gm_oExcel As Excel.Application

gm_oExcel.ActiveCell.FormulaR1C1 = "=SUM(R[gEndRow]C[-1]:R[gStartRow]C[-1])"
n
Any help would be great
John
Oct 25 '06 #1
2 2669
NeoPa
32,556 Expert Mod 16PB
Certainly .FormulaR1C1 is the correct property to set in these circumstances.
Another point to look out for is that the Format of these cells must NOT be Text (.NumberFormat = "@").
Last point I noticed, if gEndRow & gStartRow are variables in your Access VBA code then they should be coded something like :-
Expand|Select|Wrap|Line Numbers
  1. gm_oExcel.ActiveCell.FormulaR1C1 = "=SUM(R" & gEndRow & "C[-1]:R" & gStartRow & "C[-1])"
Hope this helps.
Oct 25 '06 #2
Certainly .FormulaR1C1 is the correct property to set in these circumstances.
Another point to look out for is that the Format of these cells must NOT be Text (.NumberFormat = "@").
Last point I noticed, if gEndRow & gStartRow are variables in your Access VBA code then they should be coded something like :-
Expand|Select|Wrap|Line Numbers
  1. gm_oExcel.ActiveCell.FormulaR1C1 = "=SUM(R" & gEndRow & "C[-1]:R" & gStartRow & "C[-1])"
Hope this helps.
Thank you for your help I realy apreciate it

John
Oct 27 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Pohl | last post by:
Hallo Zusammen, in der Access Datenbank mit Produktionsdaten werden tägliche Auswertungen benötigt. Zur Zeit gibt es einen Tagesauswertung als Aceess Bericht. Eine zukünftige Anforderung besteht...
0
by: madsgormlarsen | last post by:
Import of html tables to access (or exel), but it fills a column instead of a row. I have tried to import a html tables to access/exel, but both exel and access fills a column instead of a row. ...
2
by: Sylvain GENTIN | last post by:
Hi I try to bring back to exel a string computed by VB macro function. --------------------------------------------------------- Function CameoFilter(FileName As String, ByRef TextLine As...
5
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...
5
by: Takeadoe | last post by:
I'm doubtful that the group is unbiased, but I will ask anyhow :o). If one intends to plot lots of data, primarily XY line and scatter plots, and mass produce them (in many cases I will be doing...
1
by: jl2886 | last post by:
I am just beginning to learn access for my job. I have created a table that contains certain variables and then created a form for those variables. I want some of the variables to be dependent on...
1
by: hatric | last post by:
HI i am novice to EXel and now using it, but i hav some probles in using it as database plz help viz. i am gettiing data from my colugues in exel form weekly basis and merg them in one exel sheet...
3
by: chris01 | last post by:
I am tired of building tables from scratch in html and want to know if there is a way to build an exel document and somehow imbed the table into the html, either through php or java. I dont want...
24
by: joeldault | last post by:
Question For Microsoft Access Data Base -------------------------------------------------------------------------------- I am Trying to create a single formula that would do the following: If...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
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...

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.