LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
beauty_bobaloo
 
Posts: n/a
Default run macro when cell is selected

Yes, thankyou, I did see that. I have now got it working with only a couple
of lines of code, and it works Great. I have just implemented the project
that I was working on, and the users are very impressed, and so am I.
Thankyou again for all your help.

Melissa

"Otto Moehrbach" wrote:

Melissa
Did you understand Dave's response that you don't have to copy the code
150 times (in fact you can't do that, it won't work)? Look at what Dave
gave you and you will see that you need only the one macro and that all the
cells will be listed in that one macro. HTH Otto
"beauty_bobaloo" wrote in message
...
Yes the cells are in specific areas.

This should work great!

Thankyou again for all of your help. This is the first question that I
have
had to post (as I have been able to figure out my problems reading other
posts), And I am surprised and grateful for the prompt and knowledgable
resposes.

Melissa

"Dave Peterson" wrote:

Are the cells in a specific area:

if intersect(target,me.range("a1:a9,b12:b33,c1:c99")) is nothing then
'do nothing
else
macro1
end if


beauty_bobaloo wrote:

YOU GUYS ARE BRILLIANT!
Thankyou so much, I got it to work just by changing the cell reference
to
upper case. I then changed the code as suggested. I am now going to
proceed
to do this for about 150 cells. When any of these cells are pressed, I
want
it to run the same macro, and use the value in the selected cell in the
macro
so as to have a different outcome each time. I should just be able to
copy
this code 150 times and put in the different cell references. Do you
think
all of this will slow things down too much? Is there maybe a better way
to do
this?

thanks again for your help.

Melissa

"Dave Peterson" wrote:

Just a word of warning:

If Target.Address = "$a$1" Then macro1

won't ever fire macro1--assuming "option compare text" isn't
included.

..Address will be upper case:
If Target.Address = "$A$1" Then macro1

===
I like this format:

if intersect(target,me.range("a1")) is nothing then
'do nothing
else
macro1
end if

I find it easier to type (no case worries) and easier to add more
cells to the
check.



Otto Moehrbach wrote:

Change what you to the following:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$a$1" Then macro1
End Sub

"beauty_bobaloo" wrote
in message
...
I have been trying to figure this out for hours now.

I just want to run a macro when a certain cell is selected.
upon investigation, i have found that I can right click on the
sheet tab
and
view the code. I can then add the following code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$a$1" Then
run(macro1)
end if
End Sub

I know that this doesn't work, but I can't figure out how to get
it to
work.
Any help will be greatly appreciated.

thanks in advance

Melissa

--

Dave Peterson


--

Dave Peterson






 
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
Running a macro in a selected cell... Steve Excel Discussion (Misc queries) 2 January 19th 06 10:58 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
move to another cell within a subtotal report within a macro NoelH Excel Worksheet Functions 1 August 31st 05 03:02 PM
in cell editing macro ynissel Excel Discussion (Misc queries) 2 July 27th 05 07:28 PM
Relative Cell position NOT working with or without macro Scratching my Head Excel Discussion (Misc queries) 6 May 30th 05 06:12 PM


All times are GMT +1. The time now is 06:52 AM.

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"