Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Verify Active Cell


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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Verify Active Cell

Hi Brian,

Try something like:

'=========
Public Sub AAA()
If ActiveCell.Row = 6 And ActiveCell.Row <= 20 Then
'Do something, e.g.:
MsgBox "OK"
Else
'do something else, e.g.:
MsgBox "Not OK"
End If

End Sub

'<<=========

---
Regards,
Norman


"Brian Matlack"
wrote in message
news:Brian.Matlack.1z9rxa_1133286602.4575@excelfor um-nospam.com...

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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Verify if Comment exist in a cell Tom LeBold Excel Discussion (Misc queries) 2 September 15th 05 08:47 PM
How to verify a cell is in a named range Terry Lowe[_2_] Excel Programming 1 July 14th 04 01:06 AM
verify cell if is the same benny Excel Programming 1 July 8th 04 03:55 PM
Verify that the vbe is active when using sendkeys [email protected] Excel Programming 2 April 28th 04 07:46 PM
Verify starting cell for macro Don Cameron Excel Programming 3 September 6th 03 03:29 PM


All times are GMT +1. The time now is 12:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"