arrays


VBA: Referencing Arrays in Formula


I am trying to create a macro that loops through columns to apply a formula. In the last part of the formula, I need to multiply by a value. This value changes for each column (but is consistent for each row within the column).
I have attempted to define an array to do this (containing the different multipliers), but get a #NAME? error, and can see that the name of the array is appearing in the formula bar as opposed to the actual value. My code is below.
I appreciate the help - I'm very new at this!
Sub CotData()
Dim Rng1 As Range
Dim Element As Integer, ColNum As Integer
Dim slope_array As Variant
Set Rng1 = Sheets("Co(t) OREAS 901").Range("A48:A127")
ActiveWorkbook.Names.Add Name:="slope", RefersTo:=Rng1
Range("A1").Select
ActiveCell.Offset(2, 3).Range("A1").Select
slope_array = Range("slope")
Element = 0
For ColNum = 4 To 320
Element = Element + 1
ActiveCell.FormulaR1C1 = "=('Co(t) OREAS 901'!RC[-2])/('Co(t) OREAS
901'!RC[-1]* (slope_array(Element,1)))"
ActiveCell.Select
Selection.AutoFill Destination:=ActiveCell.Range("A1:A40")
ActiveCell.Range("A1:A40").Select
Next ColNum
End Sub

Related Links

Finding indices of max value in swift array
How to store the multiple positions of a character in a string inside an array in free format RPGLE?
How to map enum types to character arrays?
If-else inside a foreach doesn't return what I think it should
Helper function to iterate over an array in a rotating fashion
R paired t test between each row of 3d array
How to better use repeat while loop for indexing and array
MongoDB array duplicates
How to store input from a loop to an array in assembly(mips). How to store the integers I read in arrA?
C assembly error for a given array
Excel Array formula using INDEX and is variable dependant
Filter data from array Angular 2
Writing to an HDF5 file in parallel using chunking in fortran
remove oldest N elements from MongoDB array
How to display array elements in UITextField in swift 3?
Reshape NxNxM array to MxNxN

Categories

HOME
openssl
raspbian
backup
thunderbird-addon
tomcat7
is-empty
snap.svg
triggers
websphere-liberty
outlook-web-addins
wordpress-theming
uiscrollview
tee
cs-cart
mongodb-query
activesync
cloudflare
reduction
yeoman-generator
zoomcharts
saiku
derived
jogl
nmake
pipelinedb
ui5
dpi
bitcoin-testnet
bxslider
superscript
ifstream
data-extraction
large-data
nunit-3.0
silverlight-3.0
parent
alchemy.js
linq-to-entities
infusionsoft
jdbi
archer
onmouseover
azure-availability-set
jtds
dwarf
decompress
tofixed
jszip
visual-studio-templates
garrys-mod
onresume
efxclipse
manifest.mf
git-annex
uiprogressview
jackson-databind
soda
listadapter
ng2-material
logcat
search-regex
supportmapfragment
concur
web-essentials
license-key
lemoon
datainputstream
hornetq
response-headers
programming-paradigms
built-in
coypu
pylearn
apache-mina
gulp-livereload
git-checkout
jai
activity-streams
pgagent
smartystreets
factors
unison
dynamic-proxy
jquery-tabs
nservicebus4
dllexport
stagefright
visual-studio-2003
fraud-prevention
qss
moq-3
autostart
getusermedia
redirectstandardoutput
wcf-web-api
visual-web-gui
zookeeper
datamember
gtk2hs
server-error
exitstatus
task-management
revert
clients
scala-2.8
chdatastructures
graph-layout
weborb
self-reference

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App