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

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
Ada How to get input a list of integer from a user and put it into an array
count occurences in for loop
Update / create subdocument in array
Delphi: const list of const objects [duplicate]
Fastest way to search through a CSV and return specific array of values (Ruby)
Excel complicated array

Categories

HOME
sql-server-2008
visual-studio-2015
checkbox
filterrific
webrtc
facebook-graph-api
terrain
gspread
google-spreadsheet-api
ng-admin
structuremap
deeplearning4j
shipping
unity2d
uiactivityviewcontroller
cartodb
cpanel
equalizer
postmessage
line-api
rhapsody
cairo
movies
zoho
nmake
uiautomator
apple-tv
tcpclient
iup
rworldmap
restfb
osmdroid
ui5
helper
solidworks
pitest
red-black-tree
piecewise
npm-shrinkwrap
oscommerce
mmdrawercontroller
office365connectors
meta-raspberrypi
viewgroup
microdata
html-agility-pack
intersystems-ensemble
homekit
stress-testing
rich-text-editor
php-ews
email-parsing
vcf
production-environment
tofixed
butterknife
info
photography
fontconfig
communication-protocol
svn-merge
push-diffusion
children
visible
uiprogressview
image-editing
gmsmapview
selecteditem
gradle-release-plugin
aerogear
handlebars.java
enyo
site-prism
ffprobe
swift2.1
django-1.6
scala-2.11
ibmsbt
adcolony
cg
ogr2ogr
dache
neoload
colt
wss
slick-2.0
openkinect
visual-studio-addins
localtime
xml-libxml
returnurl
wcf-web-api
rose-db-object
entity-framework-ctp5
zookeeper
charts4j
server-error
pantheios
getresource
svn-hooks
mvccontrib-grid
sitemappath
revert
grooveshark
rtsp-client
dirty-data





Mobile Apps Dev
Database Users
javascript
java
csharp
php
android


MS Developer
developer works
python
ios
c
html
jquery


RDBMS discuss