Hi Rob,
Try this modified codes.
Private Sub Worksheet_SelectionChange(ByVal Target As
Excel.Range)
Dim rngChequeNo As Range
Dim af As WorksheetFunction
Set af = Application.WorksheetFunction
Set rngChequeNo = [G27:G1524]
Dim ILastCheque
If Target.Cells.Count > 1 Or Intersect(Target,
rngChequeNo) Is Nothing Then Exit Sub
ILastCheque = InputBox("Enter Ch. No.", "Cheque Book
Entry", af.Max(rngChequeNo) + 1)
If ILastCheque <> "" Then Target.Value = ILastCheque
End Sub
Regards,
Shailesh Shah
http://members.lycos.co.uk/shahweb/
(Excel Add-ins)
-----Original Message-----
Hi Kieran,
Thanks for your reply. I tried to put it into my procedure but keep getting
Run-time error 6...."Overflow" occuring.
Any Ideas?
The code is as follows:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim rngChequeNo As Range
Dim af As WorksheetFunction
Set af = Application.WorksheetFunction
Set rngChequeNo = [G27:G1524]
Dim ILastCheque As Integer
If Intersect(Target, rngChequeNo) Is Nothing Then Exit Sub
If Target.Rows.Count * Target.Cells.Count <> 1 Then
MsgBox "I can only process one cell at a time", vbInformation, _
"Cell selection Error"
Target.Cells(1).Select
Exit Sub
End If
Rob
.