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

Json object pushed into javascript array
mongo search for part of string match in words array
How to use an OR clause to filter an array in Swift
Why accessing this json sub elements by index raises this error?
How to apply WorksheetFunction.Average to a dynamic array in VBA
Getting array length in mongodb?
using vb.net and LibTiff to convert large tiff images
Storing the output of spap2 into an array then looping and graphing that output
Using intermediate variable to work with array (reference type)
Swift Creating tableView From JSON
How how convert normal string into multi-line string
How to convert a double to double array?
Use one index from array
ko.observableArray not UI not UPdating.
Creating collection of different enums
Determine Winter or Summertime due to month (UTC Timezone) [duplicate]

Categories

HOME
vue.js
udp
wsdl
puppet
smartphone
ruby-on-rails-3
console
defragmentation
eval
cockroachdb
nuxt.js
store
uiview
phoenix
multiple-monitors
pdo
ssms-2016
google-api-java-client
sql-update
rails-activerecord
countif
ghost-inspector
go-cd
nmf
scalajs-react
rhmap
osmdroid
ui5
emv
cgal
blackboard
svnkit
stocks
polymorphism
mmdrawercontroller
jboss-esb
ksoap
coreclr
delphi-10.1-berlin
jquery-multidatespicker
brute-force
jrules
amazon-clouddrive
onmouseover
jtds
defold
amazon-machine-learning
xmgrace
pagefile
unity3d-editor
bettercms
createobject
keycode
payu
verbose
libreadline
webkit2
tomcat5
multiple-file-upload
coordinate-transformation
distribute
usb-drive
asp.net-mvc-2
optionbutton
mirrorlink
selendroid
rad
fabric-twitter
anti-patterns
subresource-integrity
divide-by-zero
digits
ember-cli-addons
sysfs
word-2013
ejabberd-saas
named-ranges
and-operator
humanizer
alpha-transparency
broadcasting
uipickerviewcontroller
circos
cling
cilk-plus
sslexception
driver-signing
multiple-conditions
fluidsynth
abnf
pitch
returnurl
blockingqueue
cadisplaylink
getstring
windows-phone-7-emulator
objective-c-protocol
userid
visual-web-gui
getresource
hardware-acceleration
sitemappath
visual-studio-2010-beta-2
handheld

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