Solved

Macro to add "product" (formula value) to cell range

Posted on 2014-04-09
6
312 Views
Last Modified: 2014-04-10
Experts:

I was wondering if someone could assist in helping me define a macro/function that adds calculated values to a cell range in Excel.

Please see attached XLS for details.

Thanks,
EEH
Add-records-to-table--cell-range.xlsx
0
Comment
Question by:ExpExchHelp
  • 3
  • 3
6 Comments
 
LVL 35

Accepted Solution

by:
Kimputer earned 500 total points
ID: 39989913
This should do it:

Dim i

Private Sub Workbook_Open()
i = 13
End Sub

Sub AddRecord()

Cells(i, 6).Value = Cells(2, 2).Value
i = i + 1


End Sub

Open in new window

0
 

Author Comment

by:ExpExchHelp
ID: 39989975
Kimputer:

I've added your recommended code to a module.   See attached XLSM.

At this time, it generates an error.

Not sure what's missing.

EEH
Add-records-to-table--cell-range.xlsm
0
 
LVL 35

Expert Comment

by:Kimputer
ID: 39990116
My code should be in ThisWorkbook, not Module1 (because The Open Workbook routine has to be there, otherwise the first row isn't initialised)
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:ExpExchHelp
ID: 39990444
Kimputer:

Ok... I moved it into ThisWorkbook... still, I get an error (see attached JPG).
Error.jpg
Add-records-to-table--cell-range.xlsm
0
 
LVL 35

Expert Comment

by:Kimputer
ID: 39991025
I checked again, the code works. Just re-assign macro to the button.
0
 

Author Comment

by:ExpExchHelp
ID: 39991203
Got it... works great!   Thanks for the help, Kimputer.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

What is a Form List Box? (skip if you know this) The forms List Box is the alternative to the ActiveX list box. If you are using excel 2007, you first make sure you have a developer tab (click the Orb)->"Excel Options"->Popular->"Show Developer tab…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now