Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Worksheet_SelectionChange

Status
Not open for further replies.

mpadgett

IS-IT--Management
Jun 24, 2005
57
US
I'm trying to use Worksheet_SelectionChange to identify if a user selects cells F4 through F30 to thus execute a macro but I'm having some difficulty with the syntax to define the F4:F30 range. Thanks for any help.
 


Hi,
Code:
  if target.count>1 then exit sub

  if not intersect(target, range("F4:F30")) is nothing then
     'do stuff here
  end if


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
identify if a user selects cells F4 through F30
If Target.Address = Range("F4:F30").Address then
MsgBox "user selects cells F4 through F30"
end If

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Sorry, I meant to state that I need to identify if a user selects a cell within F4 through F30 not all of the cells from F4 through F30. Thanks,
 


Did you try it?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 


it is exactly what my code does.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
I did try and your code and it worked perfectly if I select all cells from F4 through F30. As I mentioned in my reply, I'm actually wanting to evaluate if a user selects a cell within F4:F30. Thanks,
 



I'm actually wanting to evaluate if a user selects a cell within F4:F30.
This is EXACTLY what my code does!

Whenever you select ONE CELL within F4 - F30 the code will execute WHATEVER you put following 'do stuff here

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Your MsgBox is only being activated when I select all cells from F4 to F30. When I select anything less that that, I get nothing.
 


I DON'T HAVE A MSGBOX!!!!

That was PHV's code.

Focus!

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 


Please do not fail to respond back to resolve your thread, as you have displayed an anoying habit of not doing so, over the past 5 years.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Skip:

You're correct. My appologies! Your code works beautifully. Thank you,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top