VBA language for a range of cells

Solved/Closed
proudcuban - Jun 11, 2010 at 07:32 PM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Jun 11, 2010 at 08:12 PM
Hello, I created a calendar cell pop-up and I wanted to include it in a range of cells. However I can't figure out how to include an entire range of cells (A4:A300) without having to input each cell separately. Here is the example bellow.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Select Case Target.Address

Case "$D$3", "$D$4", "$D$5", "$D$6", "$D$7", "$D$8", "$D$9", "$D$10", "$D$11", "$D$12", "$D$13", "$D$14", "$D$15", "$D$16", "$D$17", "$D$18", "$D$19", "$D$20", "$D$21", "$D$22", "$D$23", "$D$24", "$D$25", "$D$26", "$D$27", "$D$28", "$D$29", "$D$30", "$D$31", "$D$32", "$D$33", "$D$34", "$D$35", "$E$3", "$E$4", "$E$5", "$E$6", "$E$7", "$E$8", "$E$9", "$E$10", "$E$11", "$E$12", "$E$13", "$E$14", "$E$15", "$E$16", "$E$17", "$E$18", "$E$19", "$E$20", "$E$21", "$E$22", "$E$23", "$E$24", "$E$25", "$E$26", "$E$27", "$E$28", "$E$29", "$E$30", "$E$31", "$E$32", "$E$33", "$E$34", "$E$35", "$F$3", "$F$4", "$F$5", "$F$6", "$F$7", "$F$8", "$F$9", "$F$10", "$F$11", "$F$12", "$F$13", "$F$14", "$F$15", "$F$16", "$F$17", "$F$18", "$F$19", "$F$20", "$F$21", "$F$22", "$F$23", "$F$24", "$F$25", "$F$26", "$F$27", "$F$28", "$F$29", "$F$30", "$F$31", "$F$32", "$F$33", "$F$34", "$F$35", "$I$4"

Call OpenCalendar
End Select

End Sub

I can't believe that there isn't an easier way of doing this and I've tried multiple possibilities and combination such as "Range ("D3:D300).

I would appreciate any help on this.

Thank you,
Related:

1 response

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Jun 11, 2010 at 08:12 PM
see if this gives you some ideas


If Intersect(Target, Range("d3:f35")) Is Nothing Then

MsgBox "The active cell does NOT Intersect d3:f35"

Else

MsgBox "The active cell does Intersect d3:f35"


End If
0