PDA

View Full Version : Solved: Limit Entries



av8tordude
04-26-2009, 06:42 PM
I would like to limit the number of entries made in a spreadsheet to 10000 rows. If I select any cell in row 10000, i would have a msgbox display and run a seperate code base on the msgbox answer. Creating the msgbox is not a problem, but can someone assist me into writing the part of the code that when I select any cell in row 10000 it will open display the msgbox?

Simon Lloyd
04-26-2009, 06:54 PM
Put this in the worksheet code modulePrivate Sub Worksheet_SelectionChange(ByVal Target As Range)
Nxt:
If Target.Row > 9999 Then
msg = MsgBox("Do you want to go to A1?", vbYesNo, "Row Limit Reached")
If msg = vbYes Then
Me.Range("A1").Select
ElseIf msg = vbNo Then
MsgBox "You can't stay here all day!"
GoTo Nxt
End If
End If
End Sub

av8tordude
04-26-2009, 07:11 PM
Thank you Simon. :beerchug: BTW, very interesting msgboxs :rotlaugh: