Select ALL cells problem and advice please

jhg1226

New Member
Joined
Jul 31, 2010
Messages
6
Hi, and thanks for taking the time to view this post.

I am running the following code to create 20 or thirty message boxes that activate when particular cells are clicked. Essentially, I need to provide the user information related to specific cell entries. My problem is when the user selects the upper left cell that selects all cell on the worksheet, I get a "Run-time error '6': Overflow error".

How can I get around this problem? Second question is: Am I going about this the right way? Keep in mind I am a novice and do not want to make this too complicated.

Option Explicit


Private Sub Worksheet_SelectionChange(ByVal target As Range)
'Service


Application.ScreenUpdating = False

If Selection.Count = 1 Then
If Not Intersect(target, Range("A19")) Is Nothing Then
MsgBox "Service prior to 9-7-80 - At least 1 AND more message" & vbCrLf & _

"90 days service." & vbCrLf & vbCrLf & _

"Service after More of this message AND 24 months active service " & _

"OR served full period to which he/she was called” & vbCrLf & vbCrLf & _
"Exceptions would go here." & vbCrLf & vbCrLf & _
"Check Chart for appropriate dates." & vbCrLf & vbCrLf & _
"***Claims should be reviewed." & vbCrLf & vbCrLf & _

"If doesn't have qualifying service more of message." & vbCrLf & vbCrLf & _

"No further development is needed.***"

End If

'Presumptive Entitlement
If Selection.Count = 1 Then
If Not Intersect(target, Range("A17")) Is Nothing Then
MsgBox "More of the message " & vbCrLf & _

" Part of message:” & vbCrLf & vbCrLf & _
" Age 65 or older, OR " & vbCrLf & vbCrLf & _
" A patient in a nursing home, OR" & vbCrLf & vbCrLf & _
" Disabled with more of the message. " & vbCrLf & vbCrLf & _

" More of message. "
End If

End If
End If
End Sub



Thanks!!!
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Which line of code causes the error?

Does changing Selection.Count to Target.Count make any difference?

PS Is this all the code?
 
Upvote 0
You are correct in that the line causing the problem is Selection.count, but changing it to target.count does not help.

Yes, this is all the code. Thanks for responding!
 
Upvote 0
Change Selection.Count to Selection.CountLarge
 
Upvote 0

Forum statistics

Threads
1,213,486
Messages
6,113,932
Members
448,533
Latest member
thietbibeboiwasaco

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top