tags:

views:

25

answers:

2

Respected Sir/Madam

I want to key 60 records in first sheet, and 61th records key on next sheet. I want after 60 records cursur is go to automaticully 61th records. means after every 60th records curuser is going to next sheet.

Thankyou

A: 

With some presto code I would say the logic would be something like this

If ActiveSheet=”Sheet1” AND ActiveRow>=61 then 
    ActiveSheet=”Sheet2”
End if

I’m sorry that I’m not at a computer with office installed so cant generate the actual code but I think you see where I’m going with this

Kevin Ross
+1  A: 

From your question I think you need to use the SelectionChange event to detect when a cell on any row >60 is selected.

Private Sub Worksheet_SelectionChange(ByVal target As Range)
    If target.Row > 60 Then
        Sheets(ActiveSheet.Index + 1).Activate
        ActiveSheet.Range("A1").Activate
    End If
End Sub

This code would need to be placed in each worksheet code module that you wanted the automatic jump to the next worksheet to happen in. It makes the following assumptions:

  • It fires any time a cell with row number >60 is selected
  • It just increments the worksheet index to get the next sheet
  • It assumes your data starts in cell A1

This should allow you to get started though.

Lunatik