PC Review


Reply
Thread Tools Rate Thread

Count backwards with a for next loop

 
 
Gus Chuch
Guest
Posts: n/a
 
      26th Nov 2007
Don’t you count backwards with a for next loop using the following
For i = 1 To 4
Sheet1.Cells(i, 1) = i
Next i
I cant’ seem to get it to work. I also tried using a Step -1 but no luck
Any ideas ?
--
thank You
Gus
 
Reply With Quote
 
 
 
 
John Bundy
Guest
Posts: n/a
 
      26th Nov 2007
I think what you are wanting would be a for i = 4 to 1 step - 1
you were trying to step backward but increment at the same time.
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Gus Chuch" wrote:

> Don’t you count backwards with a for next loop using the following
> For i = 1 To 4
> Sheet1.Cells(i, 1) = i
> Next i
> I cant’ seem to get it to work. I also tried using a Step -1 but no luck
> Any ideas ?
> --
> thank You
> Gus

 
Reply With Quote
 
Jim May
Guest
Posts: n/a
 
      26th Nov 2007
Step -1 is the route!!
but you may need something like:

Sub tester()
With ActiveSheet
For i = 4 To 1 Step -1
Sheets("Sheet1").Cells(i, 1) = i
Next i
End With
End Sub

"Gus Chuch" wrote:

> Don’t you count backwards with a for next loop using the following
> For i = 1 To 4
> Sheet1.Cells(i, 1) = i
> Next i
> I cant’ seem to get it to work. I also tried using a Step -1 but no luck
> Any ideas ?
> --
> thank You
> Gus

 
Reply With Quote
 
Bob Umlas, Excel MVP
Guest
Posts: n/a
 
      26th Nov 2007
For i = 4 to 1 step -1

"Gus Chuch" wrote:

> Don’t you count backwards with a for next loop using the following
> For i = 1 To 4
> Sheet1.Cells(i, 1) = i
> Next i
> I cant’ seem to get it to work. I also tried using a Step -1 but no luck
> Any ideas ?
> --
> thank You
> Gus

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count backwards N cells cferoiu Microsoft Excel Worksheet Functions 0 2nd Feb 2010 12:50 PM
Loop backwards through selection? =?Utf-8?B?cHBzYQ==?= Microsoft Excel Programming 5 30th Jul 2007 06:02 PM
Count backwards leonidas Microsoft Excel Programming 3 29th Jun 2006 02:13 PM
How do I get the numbering to count backwards? =?Utf-8?B?c3RhdGljYXR0aWM=?= Microsoft Word Document Management 1 19th Jan 2006 07:34 PM
For..Next--How to count Backwards Eric Cathell Microsoft VB .NET 3 10th Nov 2003 03:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:10 AM.