Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi guys,
Thx a lot for all your help over the past months!! I have an userform, and I would like to create 2 commandbuttons tha will allow the user to move from one worksheet to the next and th other to move from one worksheet to the previous and when the last o first worksheet is reached to keep going in circles. i.e. if user reaches last worksheet and clicks Next to go back to firs worksheet. I have a total of 9 worksheets, is that is important. This is probably the easiest problem to solve, I'm sure. - Larry - VBA Amateu -- Message posted from http://www.ExcelForum.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi nrage21,
I have an userform, and I would like to create 2 commandbuttons that will allow the user to move from one worksheet to the next and the other to move from one worksheet to the previous and when the last or first worksheet is reached to keep going in circles. i.e. if user reaches last worksheet and clicks Next to go back to first worksheet. Something like this should work: Private Sub cmdPrevious_Click() If ActiveSheet.Index = 1 Then Sheets(Sheets.Count).Activate Else Sheets(ActiveSheet.Index - 1).Activate End If End Sub Private Sub cmdNext_Click() If ActiveSheet.Index = Sheets.Count Then Sheets(1).Activate Else Sheets(ActiveSheet.Index + 1).Activate End If End Sub -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
if activeSheet.Index = Sheets.count then
Sheets(1).Activate else sheets.Next.Activate End if if activeSheet.Index = 1 then Sheets(Sheets.count).Activate else sheets.Previous.Activate End if -- Regards, Tom Ogilvy "nrage21 " wrote in message ... Hi guys, Thx a lot for all your help over the past months!! I have an userform, and I would like to create 2 commandbuttons that will allow the user to move from one worksheet to the next and the other to move from one worksheet to the previous and when the last or first worksheet is reached to keep going in circles. i.e. if user reaches last worksheet and clicks Next to go back to first worksheet. I have a total of 9 worksheets, is that is important. This is probably the easiest problem to solve, I'm sure. - Larry - VBA Amateur --- Message posted from http://www.ExcelForum.com/ |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the quick replies guys!
(Tom: now I can put the comments to a face... I saw a picture of yo and Chip in Chip Pearson Site... "gentle faces") :) - Larry - VBA Amateu -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
buttons and boxes in userform | Excel Discussion (Misc queries) | |||
Excel print preview next and previous buttons seem to be backwards | Excel Discussion (Misc queries) | |||
Display first, next, previous on userform from recordset | Excel Programming | |||
Naming buttons in Userform on the fly | Excel Programming | |||
How to add textbox/buttons to an UserForm | Excel Programming |