View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_4_] Jim Thomlinson[_4_] is offline
external usenet poster
 
Posts: 1,119
Default Verify Active Cell

Untested but this should be close...

dim rng as range

on error resume next
set rng = intersect(activecell, sheets("Sheet1").range("6:20"))
on error goto 0

if rng is nothing then
msgbox "Sorry. The active cell is not in the right place."
else
'Your Code
end if
--
HTH...

Jim Thomlinson


"Brian Matlack" wrote:


Hi!
What code would I use to Verify that the Active cell is with in a range
(say between row 6 and 20) before allowing the macro to continue.

I want the user to choose a cell within a given range of rows and then
click the delete button to delete the data in the cells of that row. I
want the macro to stop and a msgbox to appear telling them to choose a
cell within the range.

I have the code for the deleting and the msgbox I just don't know how
to verify the active cell.

Thanks!!


--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...fo&userid=3508
View this thread: http://www.excelforum.com/showthread...hreadid=489137