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

Commas do not echo with line
data structure interview : find max number in array
codeigniter pass array in session and retrieve
Make a replaceAll look once at each char from String (because of for-loop)
array of class keep throwing error messages
accumarray(subs, val) where val has zeros
bash curl array from text file [closed]
Quickest way to hide an array of pictureboxes
Perl IO::Pipe does not work within arrays
Array Declaration in CFScript
Select combination of elements from array whose sum is smallest possible positive number
Issue While Loop Apache Status
Add multiple polylines to a single Array
variable changing value unexpectedly only when equal to zero in MASM32
An issue with Arrays
Converting String to array of characters

Categories

HOME
makefile
dotnetrdf
drupal-7
boost-thread
jbehave
visualization
playframework
survival-analysis
appmaker
gspread
oclint
wicket
onsen-ui2
maxima
eclipse-luna
sendkeys
medium-editor
scalaz7
richfaces
mef2
pptp
frp
pcre
pari
spring-insight
rhomobile
npm-shrinkwrap
nunit-3.0
readfile
poco-libraries
fltk
polyfills
floating-accuracy
ical-dotnet
html-agility-pack
tango
ideone
web-deployment-project
opencpu
gradle-script-kotlin
iostat
chessboard.js
git-annex
dts
django-filer
spark-cassandra-connector
spring-repositories
remoteapp
selecteditem
search-regex
concur
group-concat
anythingslider
plone-3.x
schtasks.exe
zuora
p-np
retro-computing
searchkick
android-search
c++-actor-framework
tilestache
activity-streams
scala-2.11
facebook-wall
planetary.js
magic-numbers
late-static-binding
bounds
db4o
chrome-for-android
operations
mimosa
loop-invariant
onselect
pep8
deploying
isolatedstorage
makefile-project
separation-of-concerns
entity-framework-ctp5
viewdidload
msbuildextensionpack
getresource
carbide
graniteds
linfu
savestate
multibyte-functions
act

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