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

Hi Nigel,

Would I place the "If ActiveSheet.name="Sheet2" Then right after th
Private Sub CommandButtons for each script? I really don't want t
disable or hide anything. I have not tried this script out, I'm a
work right now and won't be at home to try this until after 9:00p
tonight. I also place an End if at the end of each script before th
End Sub line.



Private Sub CommandButton5_Click() [for the next button]
If ActiveSheet.Name = "Sheet2" Then

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 If
End Sub



Private Sub CommandButton6_Click() [for the previous button]
If ActiveSheet.Name = "Sheet2" Then

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 If
End Sub



Thanks,

marty

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