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

How to map a JOIN onto an array of structs with a child array of structs
Could not cast value of type 'Swift.Array<Swift.AnyObject>' to 'Swift.Array<SomeModelClass>'
string array to new sheet
Sum, Median and Mean of rainfall over different periods in Excel
How to put array of string into another array in Swift?
Finding the k'th element in unsorted array using external function
How to stack arrays in repa (Haskell)
Comma delimited string to array using regular expressions
Can somebody please explain this pseudo code to me in terms of java code?
Parsing currency value in Excel VBA
Replacing values in one array/list by index of another array/list
Iterate over an array in a certain order, so that it is sampled fairly
Perl - initialization of hash
Array as property in BreezeJS model
Swift - check if array contains element with property [duplicate]
Ruby Array of Arrays Group and Count by Values

Categories

HOME
json
jsf
ibm-watson-cognitive
angular2-routing
fparsec
json-ld
extract
mainframe
automated-tests
vlc
pygame
i2c
jboss-eap-7
xamarin-studio
cartodb
finite-group-theory
ctypes
cpanel
mod-pagespeed
android-toolbar
cairo
redux-observable
aptana
google-api-java-client
primes
jni
flexboxgrid
autolayout
logarithm
samsung-mobile
geopandas
continuous-deployment
hash-collision
cep
jboss5.x
referenceerror
read-write
receipt
swiftcharts
rhino
viewstate
lego
nodeclipse
autocompletetextview
socketpair
magiczoomplus
fax
equivalence
alchemy.js
infusionsoft
exiftool
bayesian-networks
sendgrid-templates
google-account
tableau-server
timesten
taskmanager
ideone
gd
persistent
chrome-remote-desktop
jexl
fedora20
opencpu
verbose
multiple-file-upload
shipitjs
inotifypropertychanged
fps
asp.net-mvc-2
bluesnap
magento-1.4
galaxy
self-hosting
datainputstream
hornetq
kendo-menu
qbfc
xjc
pylearn
obfuscar
adcolony
node-inspector
mov
surrogate-key
alertifyjs
ifft
dbsetup
xenocode
flash-cc
dynamic-proxy
onselect
ng-pattern
apache2.2
qtgui
graph-coloring
objcmongodb
arbor.js
cgpath
wcf-web-api
hibernate3
throttling
qtembedded
mvccontrib-grid
unreachable-code
external-assemblies
asp.net-mvc-controller
integer-promotion
data-entry

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