#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default Looping

I want to start in cell A1 and each time I click a button on a userForm I
want the cursor to move to the next cell, in this case, a2. Then, if the
cursor is in a2, when the button is clicked again, I would like the cursor to
move to a3.

Any ideas?

Thanks,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Looping

One way:

Private Sub CommandButton1_Click()
With Selection
If .Row + .Rows.Count = .Parent.Rows.Count Then
.Parent.Cells(1, .Column).Resize( _
.Rows.Count, .Columns.Count).Select
Else
.Offset(1, 0).Select
End If
End With
End Sub


In article ,
"Steve" wrote:

I want to start in cell A1 and each time I click a button on a userForm I
want the cursor to move to the next cell, in this case, a2. Then, if the
cursor is in a2, when the button is clicked again, I would like the cursor to
move to a3.

Any ideas?

Thanks,

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Looping

Try:

If ActiveCell.Row < 65536 Then Cells(ActiveCell.Row + 1,
ActiveCell.Column).Select


"Steve" wrote:

I want to start in cell A1 and each time I click a button on a userForm I
want the cursor to move to the next cell, in this case, a2. Then, if the
cursor is in a2, when the button is clicked again, I would like the cursor to
move to a3.

Any ideas?

Thanks,

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Looping David T Excel Discussion (Misc queries) 2 August 30th 06 10:51 PM
Next For looping in a If Jean-Jerome Doucet via OfficeKB.com Excel Programming 7 July 12th 05 07:46 PM
Looping Gusset Gadder Excel Programming 2 December 11th 04 09:16 PM
Looping scottwilsonx[_54_] Excel Programming 0 October 5th 04 04:29 PM
Looping scottwilsonx[_52_] Excel Programming 1 October 5th 04 04:13 PM


All times are GMT +1. The time now is 07:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"