View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
marty6[_12_] marty6[_12_] is offline
external usenet poster
 
Posts: 1
Default Specifying activesheets to multiple buttons....possible?

Hi,

I am working with a multiple page userform. On page one, I have th
following command buttons:

Enter (sheet 1)
Enter (sheet 2)

The first button inputs information into sheet 1 and the 2nd butto
"enter sheet 2" inputs information onto sheet 2.

On page two of the multiple page userform, I have the followin
buttons:

Update
Next Record
Previous Record

question: Is there a way to specify that only "next record" an
"Previous record" buttons only work with Sheet 2? When I started usin
the multipage form, and used the 2nd multpage buttons and not realizin
that sheet 1 was being displayed in the textboxes. This sound
strange. But when sheet 1 is up and running, and I am using th
multipage 2 buttons, sheet 1 information is appearing...I really don'
want that to happen.

Here's the coding for the Next and Previous buttons:

Private Sub CommandButton5_Click() [for the next button]

Dim lastRow As Long
If ActiveCell.Column < 1 Then
Cells(ActiveCell.Row, 1).Select
End If
If ActiveCell.Row < lastRow Then
ActiveCell.Offset(1, 0).Select
TextBox18.Text = ActiveCell.Value
TextBox19.Text = ActiveCell.Offset(0, 1).Value
TextBox20.Text = ActiveCell.Offset(0, 2).Value
TextBox21.Text = ActiveCell.Offset(0, 3).Value
TextBox22.Text = ActiveCell.Offset(0, 4).Value
TextBox23.Text = ActiveCell.Offset(0, 5).Value
TextBox24.Text = ActiveCell.Offset(0, 6).Value
TextBox25.Text = ActiveCell.Offset(0, 7).Value
TextBox26.Text = ActiveCell.Offset(0, 8).Value
TextBox27.Text = ActiveCell.Offset(0, 9).Value
End If
End Sub



Private Sub CommandButton6_Click() [for the previous button]
If ActiveCell.Column < 1 Then
Cells(ActiveCell.Row, 1).Select
End If
If ActiveCell.Row < 1 Then
ActiveCell.Offset(-1, 0).Select
TextBox18.Text = ActiveCell.Value
TextBox19.Text = ActiveCell.Offset(0, 1).Value
TextBox20.Text = ActiveCell.Offset(0, 2).Value
TextBox21.Text = ActiveCell.Offset(0, 3).Value
TextBox22.Text = ActiveCell.Offset(0, 4).Value
TextBox23.Text = ActiveCell.Offset(0, 5).Value
TextBox24.Text = ActiveCell.Offset(0, 6).Value
TextBox25.Text = ActiveCell.Offset(0, 7).Value
TextBox26.Text = ActiveCell.Offset(0, 8).Value
TextBox27.Text = ActiveCell.Offset(0, 9).Value
End If
End Sub



Any and all help is appreciated.

thanks,

marty

--
Message posted from http://www.ExcelForum.com