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

Why it is {“Index was outside the bounds of the array.”}with my code with no error in it
How to manually convert an integer into an IP address in Ruby
Taking last word of an string, variable not declared?
Separate string into array and then filter it [duplicate]
Protractor: How to store number text from div element
Weird results with parsing array from json in Swift3
How can I declare an array with diffrent type of data?
Trying to append content to numpy array
MongoDb $addFields inside arrays that $multiply two values within the array
bash: sed search and replace the path of array elements
Scala way for converting Long to ArrayByte
How to Assign Multidimensional Array Values to Tableview Cell swift 3
bring MC to stage with button
Extension file when called in not refreshing (swift3)
SAS - Transform dataset from wide to tall using arrays
How to remove duplicate value in an array Angular 2

Categories

HOME
plsql
puzzle
itext
ncurses
cpu-architecture
vs-team-services
command
rfc
ll
websphere-liberty
diagram
uisplitviewcontroller
jcl
attask
styles
mousewheel
pycrypto
multiple-columns
shippo
statusbar
autolayout
profile
delete-file
bootstrap-typeahead
logarithm
activepython
metis
codelite
i3
configure
expand
pdflatex
ifstream
hawtio
service-locator
powershell-remoting
wfp
vsts-package-management
dql
strstr
declare
topic-modeling
concrete5-5.7
delphi-10.1-berlin
s3cmd
lexical-analysis
wsadmin
onbackpressed
web-development-server
microdata
excel-interop
g1gc
cppunit
gist
jenkins-jira-trigger
livescribe
cdk
adler32
redux-router
efxclipse
push-diffusion
backstop.js
rstudio-server
wcf-ria-services
firepath
instruments
multiple-file-upload
asteriskami
boost-hana
gradle-release-plugin
concur
proxygen
loose-typing
insertion-sort
jta
lmfit
subresource-integrity
twython
ffserver
mdm-zinc
google-earth-plugin
android-search
tcpreplay
microblaze
fragment-tab-host
em
smartystreets
android-looper
ifft
dbsetup
winrt-httpclient
visual-c++-2010-express
cling
driver-signing
vertical-rhythm
sql-server-2012-web
dllexport
ruboto
threadx
qss
qtgui
reporting-tools
mvs
crocodoc
scrollto
shim
legacy-code
unions
z-machine
concurrent-programming
nintendo
scraperwiki
nagle
dirty-data
castle-validators

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile