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

VB and general logical undarstanding
How to select options based on character user input stored in an array in C?
Remove duplicate array elements with O(N) by not using collections? [duplicate]
Calculate the derivative of a vector
How to assign excel cell with string to array value in visual basic?
python 3 read array (list?) into new values
Decrypt an array of strings in vb.net
bash array with new line as IFS
create new object in array (which is in a object which is in an array which is document) in meteor/mongodb
Initializing an array of records in VHDL
Perl Array and Hash references Handling
Separating digits in decimal representation of integer
How do I return an array from an array function using groovy?
Perl - Reading two files to compare contents
Accessing hash values(arrays) in Perl
C - Errors in header file

Categories

HOME
vue.js
ember.js
cil
admin-on-rest
signalr
nlp
vb6
filterrific
wildcard
wxwidgets
decorator
ubuntu-12.04
couchdb-2.0
wampserver
flyway
laravel-4
gspread
filter
tizen-wearable-sdk
packer
criteria
powershell-v3.0
wordpress-theming
data-synchronization
ctypes
automata
cosmicmind
zend-framework-mvc
eclipselink
attask
clover
flexboxgrid
raphael
k2
cronet
partial-application
weinre
expand
getline
hawtio
modelandview
pycparser
npm-shrinkwrap
recurrence-relation
hashcat
wfp
codesys
viewgroup
jrules
catia
rdw
multi-agent
rhel6
gce
iphone-developer-program
communication-protocol
redux-router
gulp-typescript
verbose
mailcatcher
aescryptoserviceprovider
mix
excon
firepath
angularjs-ng-pattern
bacnet
asteriskami
dojox.charting
spring-lemon
achievements
aerogear
yoothemes
insertion-sort
throughput
selendroid
calibration
castle-windsor-3
leadtools-sdk
google-plus-one
es2015
ibmsbt
grunt-contrib-concat
genetic-programming
adaptive-compression
dbsetup
operations
exiv2
ng-hide
haskell-platform
gridworld
vmware-server
multiple-conditions
justgage
qss
database-permissions
magickwand
socketstream
xgettext
icefaces-3
deploying
die
makefile-project
v4l
cross-domain-policy
throttling
electronic-signature
sendfile
osx-leopard
yajl
boost-date-time
openvg
outlook-form
database-diagramming

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