nth cell in the range

F

Frank Kabel

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
 
A

Anne-Marie

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 **
 
F

Frank Kabel

Hi
code works for me (after adapting to my workbook set-up). What error
message do you receive?
 
F

Frank Kabel

Hi
check that the Excel/Office library is set in your VBA environment
8'goto 'tools - references' for this)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top