Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Enumeration Of a (For...Next) In a Excel Column

Status
Not open for further replies.

RodMaz

Technical User
Nov 11, 2003
5
CA
Hi can someone just guide me on how to copy the result each time my For..Next loop in a Excel Column. That would be to eventualy produce some Graphics.

Pretty new to that programming so don't be to harsh heheh :p

Thanks

Rod
 
Hi,
Code:
with activesheet.usedrange
  r1=.row
  r2=r1+.rows.count-1
  c1=.column
  c2=c1+.columns.count-1
end with
for r = r1 to r2
  range(cells(r, c1), cells(r, c2)).copy destination:=cells(r, c2+2)
next
copies each row of data in the used range to a range 2 columns to the right of the used range.

hope this example helps :)

Skip,
Skip@TheOfficeExperts.com
 
Hmmm I,m built too low [hammer]... could you supply a little more info?

 
Well The problem is That i have created

For I = StartTime to StopTime Step StepTime
..
Next I

The Thing I would like is to each Step take the result of the loop and copy it in a Cell Excel...

Filling up a Column to be able to do a Graphic after

I'll try SkipVought example...

Thanks for the speed of the response anyway hehehe tahts pretty nice
 
I didnt want all the range to copy itself... so if i want juste like E4 and E5 to copy itself as it changes (cause its where the simulation is shown) what should i do ?

I Have this... it works but i know that its just using the same range so it just goes 2 column on the side and overight the results...

With Worksheets("Simulation").Range("E4:E5")
r1 = .Row
r2 = r1 + .Rows.Count - 1

c1 = .Column
c2 = c1 + .Columns.Count - 1
End With

For r = r1 To r2
Range(Cells(r, c1), Cells(r, c2)).Copy Destination:=Cells(r, c2 + 2)
Next

Whats should i do to make it continue

Thanks
 
have a bash with this....


ctr = 1
For I = StartTime to StopTime Step StepTime
'do some calcs I presume
range("E4:E5").copy destination:= cells(ctr,7)
ctr = ctr+2
Next I

Rgds, Geoff
[blue]Si hoc signum legere potes, operis boni in rebus Latinus alacribus et fructuosis potiri potes![/blue]
Want the [red]best[/red] answers to your questions ? faq222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top