473,385 Members | 2,003 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,385 software developers and data experts.

Excel VB Code - Formula Reference Cell

13
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 how many of each of the products are contained in the table - that could be used to add the values as the table is sorted by product name (Column A).

Otherwise, if that isnt possible, can someone tell if it is possible to make the following or similar formula to use the value contained within a cell instead of -8.

ActiveCell.FormulaR1C1 = "=SUM(R[-8]C[-1]:R[0]C[-1])"

To Become For Example?:

ActiveCell.FormulaR1C1 = "=SUM(R[E1]C[-1]:R[0]C[-1])"

If anyone can help, please let me know ASAP.
Jan 4 '07 #1
1 5495
Killer42
8,435 Expert 8TB
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 how many of each of the products are contained in the table - that could be used to add the values as the table is sorted by product name (Column A).

Otherwise, if that isnt possible, can someone tell if it is possible to make the following or similar formula to use the value contained within a cell instead of -8.

ActiveCell.FormulaR1C1 = "=SUM(R[-8]C[-1]:R[0]C[-1])"

To Become For Example?:

ActiveCell.FormulaR1C1 = "=SUM(R[E1]C[-1]:R[0]C[-1])"

If anyone can help, please let me know ASAP.
The Indirect function might be some help there. To make use of it, you might need to use $A$1 format rather than R1C1 format, but I'm not sure.
Jan 5 '07 #2

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

Similar topics

9
by: Julie Miles | last post by:
I need to pull several tables of data from Excel into a web page, but when I use Excel's "Save as web page" function, I get an enormous file containing a massive amount of css formatting. I'd like...
3
by: Carlos Magalhaes | last post by:
Hey All, I am doing some excel automation using the excel COM. I can do most of the functions and its working well until I come across a formula. I can run a formula and insert the formula...
6
by: Rich Wallace | last post by:
Hi all, I have a VB app that runs and manages individual XLS files within a single COM object. Upon processing the final fie, I attempt to close out the EXCEL object and release it using...
0
by: CK | last post by:
I have an ASP.net app that uses the DataDynamics spreadbuilder. It basically creates an Excel spreadsheet and populates it with a dataset by looping through the set. Everything works great except...
0
NeoPa
by: NeoPa | last post by:
VlookUp or Vertical LookUp is a function that enables Excel to ‘Find’ related items from within a range stored elsewhere. Elsewhere can mean another excel workbook on another PC, but can also mean a...
1
by: barnzee | last post by:
Hi all, newbie here, but having a go I am trying to build a stock watchlist in excel 2007 with a dynamic link to a DDE server (paid for from a broker).There is no add-in or plug-in, I just CTL ALT...
3
by: sejal17 | last post by:
hello Can any one tell me how to read multiple worksheets from a single excel file.I have stored that excel in xml file.so i want to read that xml that has multiple worksheet.And i want to store...
3
by: sejal17 | last post by:
hello Can any one tell me how to read multiple worksheets from a single excel file.I have stored that excel in xml file.so i want to read that xml that has multiple worksheet.And i want to store...
4
by: John Brock | last post by:
I have a .NET application that, among other things, creates Excel workbooks, and I have run into a very strange problem involving formulas on one worksheet that reference values on another...
1
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.