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

Store output of ForEach into array in powershell
Display specific values from array - Laravel
Excel Array - Multiple Match Index - Not detecting one Criteria
spark scala typesafe config safe iterate over value of a specific column name
Efficient way of computing the Greatest Common Divisor from an Array - Swift [duplicate]
Read from array1 write from array2
Type Mismatch in Array
Subtracting from each element in array in python
C# Problems importing a file to an array and put each character in it's own index
How to identify the position of a sequence of elements in an array in bash
Combine values of two arrays to form key and values to hash in ruby [duplicate]
Create array with key from dict with sorted by dict values
How do I convert every element in an array to its own array?
Adding a list to an array from different file format in perl
How to use Perl `sort` and `pairwise` if I already have variables `$a` and `$b`
Sum dynamic part of array values Excel VBA

Categories

HOME
makefile
converter
dotnetrdf
security
batch-processing
ubuntu-16.04
csvhelper
rfc
rocketmq
azureservicebus
avl-tree
rfid
nixos
ssr
lagom
game-maker-studio-1.4
intellij-plugin
x-frame-options
dendrogram
zope
redux-observable
device-detection
hhvm
kitematic
delete-file
tflearn
fabric
switching
pipelinedb
version-numbering
blackboard
rowcount
spring-profiles
construct-2
edb
honeysql
google-guava-cache
ksoap
liquid-xml
es-shell
initializer
deepstream.io
parent
twiki
exiftool
mediawiki-extensions
tango
worker
taskmanager
nstouchbar
search-box
selenium-firefoxdriver
opencpu
rxvt
vici
c#-interactive
excon
gameanalytics
spark-cassandra-connector
freefem++
sun-codemodel
brackets-shell
spservices
cctray
app.xaml
visual-studio-code
team-build
calibration
manjaro
viper-architecture
uos
es2015
robocode
low-level
client-side-validation
pgagent
cloudpebble
gyroscope-framework
odftoolkit
grunt-express
vcl
dalekjs
system.web
argument-passing
httpcontext
sanitization
convex-polygon
ftp4j
reporting-tools
htmltextwriter
phpsh
zend-framework-modules
lync-server-2010
git-filter-branch
cadisplaylink
continuous-testing
concurrent-programming
law-of-demeter
shared-objects
serp
server-error
carbide
gwt-2.2-celltable
front-controller
rtsp-client
integer-promotion
handheld
visual-studio-dbpro

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