nth cell in the range

  • Thread starter Thread starter Anne-Marie
  • Start date Start date
Hi
try something like the following

sub foo()
dim c_values(1 to 100)
dim i
for i = 1 to 100
c_values(i)=activesheet.cells(i*100,"A").value
next
end sub
 
THanks for the suggestion.

I tried the line below, but it comes up with debug and in yellow.


Vt(i) = Workbooks("test2").Worksheets("Data").Cells(j, "A")

Any other suggestions?
My full loop is:
For i = 1 To nsim
j = Int(Rnd() * 100)
Vt(i) = Workbooks("test2").Worksheets("Data").Cells(j,
"A")
If Vt(i) >= K Then
Fsum = Fsum + (Vt(i) - K)
Else
End If
Next i

** Posted via: http://www.ozgrid.com
Excel Templates, Training, Add-ins & Software!
http://www.ozgrid.com/Services/excel-software-categories.htm **
 
Hi
code works for me (after adapting to my workbook set-up). What error
message do you receive?
 
Hi
check that the Excel/Office library is set in your VBA environment
8'goto 'tools - references' for this)
 
Back
Top