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 = quot;$a$1quot; 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
Try this that works, but i don't know why, sorry...
..
One for Selection change, one by formula
Private Sub Worksheet_Change(ByVal Target As Range)
macro Target
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
macro Target
End Sub
Gilles P
quot;beauty_bobalooquot; a écrit :
gt; I have been trying to figure this out for hours now.
gt;
gt; I just want to run a macro when a certain cell is selected.
gt; upon investigation, i have found that I can right click on the sheet tab and
gt; view the code. I can then add the following code:
gt;
gt; Private Sub Worksheet_SelectionChange(ByVal Target As Range)
gt; If Target.Address = quot;$a$1quot; Then
gt; run(macro1)
gt; end if
gt; End Sub
gt;
gt; I know that this doesn't work, but I can't figure out how to get it to work.
gt; Any help will be greatly appreciated.
gt;
gt; thanks in advance
gt;
gt; Melissa
Change what you to the following:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = quot;$a$1quot; Then macro1
End Sub
quot;beauty_bobalooquot; gt; wrote in message
...
gt;I have been trying to figure this out for hours now.
gt;
gt; I just want to run a macro when a certain cell is selected.
gt; upon investigation, i have found that I can right click on the sheet tab
gt; and
gt; view the code. I can then add the following code:
gt;
gt; Private Sub Worksheet_SelectionChange(ByVal Target As Range)
gt; If Target.Address = quot;$a$1quot; Then
gt; run(macro1)
gt; end if
gt; End Sub
gt;
gt; I know that this doesn't work, but I can't figure out how to get it to
gt; work.
gt; Any help will be greatly appreciated.
gt;
gt; thanks in advance
gt;
gt; Melissa
Just a word of warning:
If Target.Address = quot;$a$1quot; Then macro1
won't ever fire macro1--assuming quot;option compare textquot; isn't included.
..Address will be upper case:
If Target.Address = quot;$A$1quot; Then macro1
===
I like this format:
if intersect(target,me.range(quot;a1quot;)) 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:
gt;
gt; Change what you to the following:
gt; Private Sub Worksheet_SelectionChange(ByVal Target As Range)
gt; If Target.Address = quot;$a$1quot; Then macro1
gt; End Sub
gt;
gt; quot;beauty_bobalooquot; gt; wrote in message
gt; ...
gt; gt;I have been trying to figure this out for hours now.
gt; gt;
gt; gt; I just want to run a macro when a certain cell is selected.
gt; gt; upon investigation, i have found that I can right click on the sheet tab
gt; gt; and
gt; gt; view the code. I can then add the following code:
gt; gt;
gt; gt; Private Sub Worksheet_SelectionChange(ByVal Target As Range)
gt; gt; If Target.Address = quot;$a$1quot; Then
gt; gt; run(macro1)
gt; gt; end if
gt; gt; End Sub
gt; gt;
gt; gt; I know that this doesn't work, but I can't figure out how to get it to
gt; gt; work.
gt; gt; Any help will be greatly appreciated.
gt; gt;
gt; gt; thanks in advance
gt; gt;
gt; gt; Melissa
--
Dave Peterson
Dave
Thanks for that. I will remember it. I hope. Otto
quot;Dave Petersonquot; gt; wrote in message
...
gt; Just a word of warning:
gt;
gt; If Target.Address = quot;$a$1quot; Then macro1
gt;
gt; won't ever fire macro1--assuming quot;option compare textquot; isn't included.
gt;
gt; .Address will be upper case:
gt; If Target.Address = quot;$A$1quot; Then macro1
gt;
gt; ===
gt; I like this format:
gt;
gt; if intersect(target,me.range(quot;a1quot;)) is nothing then
gt; 'do nothing
gt; else
gt; macro1
gt; end if
gt;
gt; I find it easier to type (no case worries) and easier to add more cells to
gt; the
gt; check.
gt;
gt;
gt;
gt; Otto Moehrbach wrote:
gt;gt;
gt;gt; Change what you to the following:
gt;gt; Private Sub Worksheet_SelectionChange(ByVal Target As Range)
gt;gt; If Target.Address = quot;$a$1quot; Then macro1
gt;gt; End Sub
gt;gt;
gt;gt; quot;beauty_bobalooquot; gt; wrote in
gt;gt; message
gt;gt; ...
gt;gt; gt;I have been trying to figure this out for hours now.
gt;gt; gt;
gt;gt; gt; I just want to run a macro when a certain cell is selected.
gt;gt; gt; upon investigation, i have found that I can right click on the sheet
gt;gt; gt; tab
gt;gt; gt; and
gt;gt; gt; view the code. I can then add the following code:
gt;gt; gt;
gt;gt; gt; Private Sub Worksheet_SelectionChange(ByVal Target As Range)
gt;gt; gt; If Target.Address = quot;$a$1quot; Then
gt;gt; gt; run(macro1)
gt;gt; gt; end if
gt;gt; gt; End Sub
gt;gt; gt;
gt;gt; gt; I know that this doesn't work, but I can't figure out how to get it to
gt;gt; gt; work.
gt;gt; gt; Any help will be greatly appreciated.
gt;gt; gt;
gt;gt; gt; thanks in advance
gt;gt; gt;
gt;gt; gt; Melissa
gt;
gt; --
gt;
gt; Dave Peterson
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
quot;Dave Petersonquot; wrote:
gt; Just a word of warning:
gt;
gt; If Target.Address = quot;$a$1quot; Then macro1
gt;
gt; won't ever fire macro1--assuming quot;option compare textquot; isn't included.
gt;
gt; ..Address will be upper case:
gt; If Target.Address = quot;$A$1quot; Then macro1
gt;
gt; ===
gt; I like this format:
gt;
gt; if intersect(target,me.range(quot;a1quot;)) is nothing then
gt; 'do nothing
gt; else
gt; macro1
gt; end if
gt;
gt; I find it easier to type (no case worries) and easier to add more cells to the
gt; check.
gt;
gt;
gt;
gt; Otto Moehrbach wrote:
gt; gt;
gt; gt; Change what you to the following:
gt; gt; Private Sub Worksheet_SelectionChange(ByVal Target As Range)
gt; gt; If Target.Address = quot;$a$1quot; Then macro1
gt; gt; End Sub
gt; gt;
gt; gt; quot;beauty_bobalooquot; gt; wrote in message
gt; gt; ...
gt; gt; gt;I have been trying to figure this out for hours now.
gt; gt; gt;
gt; gt; gt; I just want to run a macro when a certain cell is selected.
gt; gt; gt; upon investigation, i have found that I can right click on the sheet tab
gt; gt; gt; and
gt; gt; gt; view the code. I can then add the following code:
gt; gt; gt;
gt; gt; gt; Private Sub Worksheet_SelectionChange(ByVal Target As Range)
gt; gt; gt; If Target.Address = quot;$a$1quot; Then
gt; gt; gt; run(macro1)
gt; gt; gt; end if
gt; gt; gt; End Sub
gt; gt; gt;
gt; gt; gt; I know that this doesn't work, but I can't figure out how to get it to
gt; gt; gt; work.
gt; gt; gt; Any help will be greatly appreciated.
gt; gt; gt;
gt; gt; gt; thanks in advance
gt; gt; gt;
gt; gt; gt; Melissa
gt;
gt; --
gt;
gt; Dave Peterson
gt;
Are the cells in a specific area:
if intersect(target,me.range(quot;a1:a9,b12:b33,c1:c99quot;)) is nothing then
'do nothing
else
macro1
end ifbeauty_bobaloo wrote:
gt;
gt; YOU GUYS ARE BRILLIANT!
gt; Thankyou so much, I got it to work just by changing the cell reference to
gt; upper case. I then changed the code as suggested. I am now going to proceed
gt; to do this for about 150 cells. When any of these cells are pressed, I want
gt; it to run the same macro, and use the value in the selected cell in the macro
gt; so as to have a different outcome each time. I should just be able to copy
gt; this code 150 times and put in the different cell references. Do you think
gt; all of this will slow things down too much? Is there maybe a better way to do
gt; this?
gt;
gt; thanks again for your help.
gt;
gt; Melissa
gt;
gt; quot;Dave Petersonquot; wrote:
gt;
gt; gt; Just a word of warning:
gt; gt;
gt; gt; If Target.Address = quot;$a$1quot; Then macro1
gt; gt;
gt; gt; won't ever fire macro1--assuming quot;option compare textquot; isn't included.
gt; gt;
gt; gt; ..Address will be upper case:
gt; gt; If Target.Address = quot;$A$1quot; Then macro1
gt; gt;
gt; gt; ===
gt; gt; I like this format:
gt; gt;
gt; gt; if intersect(target,me.range(quot;a1quot;)) is nothing then
gt; gt; 'do nothing
gt; gt; else
gt; gt; macro1
gt; gt; end if
gt; gt;
gt; gt; I find it easier to type (no case worries) and easier to add more cells to the
gt; gt; check.
gt; gt;
gt; gt;
gt; gt;
gt; gt; Otto Moehrbach wrote:
gt; gt; gt;
gt; gt; gt; Change what you to the following:
gt; gt; gt; Private Sub Worksheet_SelectionChange(ByVal Target As Range)
gt; gt; gt; If Target.Address = quot;$a$1quot; Then macro1
gt; gt; gt; End Sub
gt; gt; gt;
gt; gt; gt; quot;beauty_bobalooquot; gt; wrote in message
gt; gt; gt; ...
gt; gt; gt; gt;I have been trying to figure this out for hours now.
gt; gt; gt; gt;
gt; gt; gt; gt; I just want to run a macro when a certain cell is selected.
gt; gt; gt; gt; upon investigation, i have found that I can right click on the sheet tab
gt; gt; gt; gt; and
gt; gt; gt; gt; view the code. I can then add the following code:
gt; gt; gt; gt;
gt; gt; gt; gt; Private Sub Worksheet_SelectionChange(ByVal Target As Range)
gt; gt; gt; gt; If Target.Address = quot;$a$1quot; Then
gt; gt; gt; gt; run(macro1)
gt; gt; gt; gt; end if
gt; gt; gt; gt; End Sub
gt; gt; gt; gt;
gt; gt; gt; gt; I know that this doesn't work, but I can't figure out how to get it to
gt; gt; gt; gt; work.
gt; gt; gt; gt; Any help will be greatly appreciated.
gt; gt; gt; gt;
gt; gt; gt; gt; thanks in advance
gt; gt; gt; gt;
gt; gt; gt; gt; Melissa
gt; gt;
gt; gt; --
gt; gt;
gt; gt; Dave Peterson
gt; gt;
--
Dave Peterson
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
quot;Dave Petersonquot; wrote:
gt; Are the cells in a specific area:
gt;
gt; if intersect(target,me.range(quot;a1:a9,b12:b33,c1:c99quot;)) is nothing then
gt; 'do nothing
gt; else
gt; macro1
gt; end if
gt;
gt;
gt; beauty_bobaloo wrote:
gt; gt;
gt; gt; YOU GUYS ARE BRILLIANT!
gt; gt; Thankyou so much, I got it to work just by changing the cell reference to
gt; gt; upper case. I then changed the code as suggested. I am now going to proceed
gt; gt; to do this for about 150 cells. When any of these cells are pressed, I want
gt; gt; it to run the same macro, and use the value in the selected cell in the macro
gt; gt; so as to have a different outcome each time. I should just be able to copy
gt; gt; this code 150 times and put in the different cell references. Do you think
gt; gt; all of this will slow things down too much? Is there maybe a better way to do
gt; gt; this?
gt; gt;
gt; gt; thanks again for your help.
gt; gt;
gt; gt; Melissa
gt; gt;
gt; gt; quot;Dave Petersonquot; wrote:
gt; gt;
gt; gt; gt; Just a word of warning:
gt; gt; gt;
gt; gt; gt; If Target.Address = quot;$a$1quot; Then macro1
gt; gt; gt;
gt; gt; gt; won't ever fire macro1--assuming quot;option compare textquot; isn't included.
gt; gt; gt;
gt; gt; gt; ..Address will be upper case:
gt; gt; gt; If Target.Address = quot;$A$1quot; Then macro1
gt; gt; gt;
gt; gt; gt; ===
gt; gt; gt; I like this format:
gt; gt; gt;
gt; gt; gt; if intersect(target,me.range(quot;a1quot;)) is nothing then
gt; gt; gt; 'do nothing
gt; gt; gt; else
gt; gt; gt; macro1
gt; gt; gt; end if
gt; gt; gt;
gt; gt; gt; I find it easier to type (no case worries) and easier to add more cells to the
gt; gt; gt; check.
gt; gt; gt;
gt; gt; gt;
gt; gt; gt;
gt; gt; gt; Otto Moehrbach wrote:
gt; gt; gt; gt;
gt; gt; gt; gt; Change what you to the following:
gt; gt; gt; gt; Private Sub Worksheet_SelectionChange(ByVal Target As Range)
gt; gt; gt; gt; If Target.Address = quot;$a$1quot; Then macro1
gt; gt; gt; gt; End Sub
gt; gt; gt; gt;
gt; gt; gt; gt; quot;beauty_bobalooquot; gt; wrote in message
gt; gt; gt; gt; ...
gt; gt; gt; gt; gt;I have been trying to figure this out for hours now.
gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt; I just want to run a macro when a certain cell is selected.
gt; gt; gt; gt; gt; upon investigation, i have found that I can right click on the sheet tab
gt; gt; gt; gt; gt; and
gt; gt; gt; gt; gt; view the code. I can then add the following code:
gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt; Private Sub Worksheet_SelectionChange(ByVal Target As Range)
gt; gt; gt; gt; gt; If Target.Address = quot;$a$1quot; Then
gt; gt; gt; gt; gt; run(macro1)
gt; gt; gt; gt; gt; end if
gt; gt; gt; gt; gt; End Sub
gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt; I know that this doesn't work, but I can't figure out how to get it to
gt; gt; gt; gt; gt; work.
gt; gt; gt; gt; gt; Any help will be greatly appreciated.
gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt; thanks in advance
gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt; Melissa
gt; gt; gt;
gt; gt; gt; --
gt; gt; gt;
gt; gt; gt; Dave Peterson
gt; gt; gt;
gt;
gt; --
gt;
gt; Dave Peterson
gt;
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
quot;beauty_bobalooquot; gt; wrote in message
...
gt; Yes the cells are in specific areas.
gt;
gt; This should work great!
gt;
gt; Thankyou again for all of your help. This is the first question that I
gt; have
gt; had to post (as I have been able to figure out my problems reading other
gt; posts), And I am surprised and grateful for the prompt and knowledgable
gt; resposes.
gt;
gt; Melissa
gt;
gt; quot;Dave Petersonquot; wrote:
gt;
gt;gt; Are the cells in a specific area:
gt;gt;
gt;gt; if intersect(target,me.range(quot;a1:a9,b12:b33,c1:c99quot;)) is nothing then
gt;gt; 'do nothing
gt;gt; else
gt;gt; macro1
gt;gt; end if
gt;gt;
gt;gt;
gt;gt; beauty_bobaloo wrote:
gt;gt; gt;
gt;gt; gt; YOU GUYS ARE BRILLIANT!
gt;gt; gt; Thankyou so much, I got it to work just by changing the cell reference
gt;gt; gt; to
gt;gt; gt; upper case. I then changed the code as suggested. I am now going to
gt;gt; gt; proceed
gt;gt; gt; to do this for about 150 cells. When any of these cells are pressed, I
gt;gt; gt; want
gt;gt; gt; it to run the same macro, and use the value in the selected cell in the
gt;gt; gt; macro
gt;gt; gt; so as to have a different outcome each time. I should just be able to
gt;gt; gt; copy
gt;gt; gt; this code 150 times and put in the different cell references. Do you
gt;gt; gt; think
gt;gt; gt; all of this will slow things down too much? Is there maybe a better way
gt;gt; gt; to do
gt;gt; gt; this?
gt;gt; gt;
gt;gt; gt; thanks again for your help.
gt;gt; gt;
gt;gt; gt; Melissa
gt;gt; gt;
gt;gt; gt; quot;Dave Petersonquot; wrote:
gt;gt; gt;
gt;gt; gt; gt; Just a word of warning:
gt;gt; gt; gt;
gt;gt; gt; gt; If Target.Address = quot;$a$1quot; Then macro1
gt;gt; gt; gt;
gt;gt; gt; gt; won't ever fire macro1--assuming quot;option compare textquot; isn't
gt;gt; gt; gt; included.
gt;gt; gt; gt;
gt;gt; gt; gt; ..Address will be upper case:
gt;gt; gt; gt; If Target.Address = quot;$A$1quot; Then macro1
gt;gt; gt; gt;
gt;gt; gt; gt; ===
gt;gt; gt; gt; I like this format:
gt;gt; gt; gt;
gt;gt; gt; gt; if intersect(target,me.range(quot;a1quot;)) is nothing then
gt;gt; gt; gt; 'do nothing
gt;gt; gt; gt; else
gt;gt; gt; gt; macro1
gt;gt; gt; gt; end if
gt;gt; gt; gt;
gt;gt; gt; gt; I find it easier to type (no case worries) and easier to add more
gt;gt; gt; gt; cells to the
gt;gt; gt; gt; check.
gt;gt; gt; gt;
gt;gt; gt; gt;
gt;gt; gt; gt;
gt;gt; gt; gt; Otto Moehrbach wrote:
gt;gt; gt; gt; gt;
gt;gt; gt; gt; gt; Change what you to the following:
gt;gt; gt; gt; gt; Private Sub Worksheet_SelectionChange(ByVal Target As Range)
gt;gt; gt; gt; gt; If Target.Address = quot;$a$1quot; Then macro1
gt;gt; gt; gt; gt; End Sub
gt;gt; gt; gt; gt;
gt;gt; gt; gt; gt; quot;beauty_bobalooquot; gt; wrote
gt;gt; gt; gt; gt; in message
gt;gt; gt; gt; gt; ...
gt;gt; gt; gt; gt; gt;I have been trying to figure this out for hours now.
gt;gt; gt; gt; gt; gt;
gt;gt; gt; gt; gt; gt; I just want to run a macro when a certain cell is selected.
gt;gt; gt; gt; gt; gt; upon investigation, i have found that I can right click on the
gt;gt; gt; gt; gt; gt; sheet tab
gt;gt; gt; gt; gt; gt; and
gt;gt; gt; gt; gt; gt; view the code. I can then add the following code:
gt;gt; gt; gt; gt; gt;
gt;gt; gt; gt; gt; gt; Private Sub Worksheet_SelectionChange(ByVal Target As Range)
gt;gt; gt; gt; gt; gt; If Target.Address = quot;$a$1quot; Then
gt;gt; gt; gt; gt; gt; run(macro1)
gt;gt; gt; gt; gt; gt; end if
gt;gt; gt; gt; gt; gt; End Sub
gt;gt; gt; gt; gt; gt;
gt;gt; gt; gt; gt; gt; I know that this doesn't work, but I can't figure out how to get
gt;gt; gt; gt; gt; gt; it to
gt;gt; gt; gt; gt; gt; work.
gt;gt; gt; gt; gt; gt; Any help will be greatly appreciated.
gt;gt; gt; gt; gt; gt;
gt;gt; gt; gt; gt; gt; thanks in advance
gt;gt; gt; gt; gt; gt;
gt;gt; gt; gt; gt; gt; Melissa
gt;gt; gt; gt;
gt;gt; gt; gt; --
gt;gt; gt; gt;
gt;gt; gt; gt; Dave Peterson
gt;gt; gt; gt;
gt;gt;
gt;gt; --
gt;gt;
gt;gt; Dave Peterson
gt;gt;
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
quot;Otto Moehrbachquot; wrote:
gt; Melissa
gt; Did you understand Dave's response that you don't have to copy the code
gt; 150 times (in fact you can't do that, it won't work)? Look at what Dave
gt; gave you and you will see that you need only the one macro and that all the
gt; cells will be listed in that one macro. HTH Otto
gt; quot;beauty_bobalooquot; gt; wrote in message
gt; ...
gt; gt; Yes the cells are in specific areas.
gt; gt;
gt; gt; This should work great!
gt; gt;
gt; gt; Thankyou again for all of your help. This is the first question that I
gt; gt; have
gt; gt; had to post (as I have been able to figure out my problems reading other
gt; gt; posts), And I am surprised and grateful for the prompt and knowledgable
gt; gt; resposes.
gt; gt;
gt; gt; Melissa
gt; gt;
gt; gt; quot;Dave Petersonquot; wrote:
gt; gt;
gt; gt;gt; Are the cells in a specific area:
gt; gt;gt;
gt; gt;gt; if intersect(target,me.range(quot;a1:a9,b12:b33,c1:c99quot;)) is nothing then
gt; gt;gt; 'do nothing
gt; gt;gt; else
gt; gt;gt; macro1
gt; gt;gt; end if
gt; gt;gt;
gt; gt;gt;
gt; gt;gt; beauty_bobaloo wrote:
gt; gt;gt; gt;
gt; gt;gt; gt; YOU GUYS ARE BRILLIANT!
gt; gt;gt; gt; Thankyou so much, I got it to work just by changing the cell reference
gt; gt;gt; gt; to
gt; gt;gt; gt; upper case. I then changed the code as suggested. I am now going to
gt; gt;gt; gt; proceed
gt; gt;gt; gt; to do this for about 150 cells. When any of these cells are pressed, I
gt; gt;gt; gt; want
gt; gt;gt; gt; it to run the same macro, and use the value in the selected cell in the
gt; gt;gt; gt; macro
gt; gt;gt; gt; so as to have a different outcome each time. I should just be able to
gt; gt;gt; gt; copy
gt; gt;gt; gt; this code 150 times and put in the different cell references. Do you
gt; gt;gt; gt; think
gt; gt;gt; gt; all of this will slow things down too much? Is there maybe a better way
gt; gt;gt; gt; to do
gt; gt;gt; gt; this?
gt; gt;gt; gt;
gt; gt;gt; gt; thanks again for your help.
gt; gt;gt; gt;
gt; gt;gt; gt; Melissa
gt; gt;gt; gt;
gt; gt;gt; gt; quot;Dave Petersonquot; wrote:
gt; gt;gt; gt;
gt; gt;gt; gt; gt; Just a word of warning:
gt; gt;gt; gt; gt;
gt; gt;gt; gt; gt; If Target.Address = quot;$a$1quot; Then macro1
gt; gt;gt; gt; gt;
gt; gt;gt; gt; gt; won't ever fire macro1--assuming quot;option compare textquot; isn't
gt; gt;gt; gt; gt; included.
gt; gt;gt; gt; gt;
gt; gt;gt; gt; gt; ..Address will be upper case:
gt; gt;gt; gt; gt; If Target.Address = quot;$A$1quot; Then macro1
gt; gt;gt; gt; gt;
gt; gt;gt; gt; gt; ===
gt; gt;gt; gt; gt; I like this format:
gt; gt;gt; gt; gt;
gt; gt;gt; gt; gt; if intersect(target,me.range(quot;a1quot;)) is nothing then
gt; gt;gt; gt; gt; 'do nothing
gt; gt;gt; gt; gt; else
gt; gt;gt; gt; gt; macro1
gt; gt;gt; gt; gt; end if
gt; gt;gt; gt; gt;
gt; gt;gt; gt; gt; I find it easier to type (no case worries) and easier to add more
gt; gt;gt; gt; gt; cells to the
gt; gt;gt; gt; gt; check.
gt; gt;gt; gt; gt;
gt; gt;gt; gt; gt;
gt; gt;gt; gt; gt;
gt; gt;gt; gt; gt; Otto Moehrbach wrote:
gt; gt;gt; gt; gt; gt;
gt; gt;gt; gt; gt; gt; Change what you to the following:
gt; gt;gt; gt; gt; gt; Private Sub Worksheet_SelectionChange(ByVal Target As Range)
gt; gt;gt; gt; gt; gt; If Target.Address = quot;$a$1quot; Then macro1
gt; gt;gt; gt; gt; gt; End Sub
gt; gt;gt; gt; gt; gt;
gt; gt;gt; gt; gt; gt; quot;beauty_bobalooquot; gt; wrote
gt; gt;gt; gt; gt; gt; in message
gt; gt;gt; gt; gt; gt; ...
gt; gt;gt; gt; gt; gt; gt;I have been trying to figure this out for hours now.
gt; gt;gt; gt; gt; gt; gt;
gt; gt;gt; gt; gt; gt; gt; I just want to run a macro when a certain cell is selected.
gt; gt;gt; gt; gt; gt; gt; upon investigation, i have found that I can right click on the
gt; gt;gt; gt; gt; gt; gt; sheet tab
gt; gt;gt; gt; gt; gt; gt; and
gt; gt;gt; gt; gt; gt; gt; view the code. I can then add the following code:
gt; gt;gt; gt; gt; gt; gt;
gt; gt;gt; gt; gt; gt; gt; Private Sub Worksheet_SelectionChange(ByVal Target As Range)
gt; gt;gt; gt; gt; gt; gt; If Target.Address = quot;$a$1quot; Then
gt; gt;gt; gt; gt; gt; gt; run(macro1)
gt; gt;gt; gt; gt; gt; gt; end if
gt; gt;gt; gt; gt; gt; gt; End Sub
gt; gt;gt; gt; gt; gt; gt;
gt; gt;gt; gt; gt; gt; gt; I know that this doesn't work, but I can't figure out how to get
gt; gt;gt; gt; gt; gt; gt; it to
gt; gt;gt; gt; gt; gt; gt; work.
gt; gt;gt; gt; gt; gt; gt; Any help will be greatly appreciated.
gt; gt;gt; gt; gt; gt; gt;
gt; gt;gt; gt; gt; gt; gt; thanks in advance
gt; gt;gt; gt; gt; gt; gt;
gt; gt;gt; gt; gt; gt; gt; Melissa
gt; gt;gt; gt; gt;
gt; gt;gt; gt; gt; --
gt; gt;gt; gt; gt;
gt; gt;gt; gt; gt; Dave Peterson
gt; gt;gt; gt; gt;
gt; gt;gt;
gt; gt;gt; --
gt; gt;gt;
gt; gt;gt; Dave Peterson
gt; gt;gt;
gt;
gt;
gt;
- Oct 22 Sun 2006 20:09
run macro when cell is selected
close
全站熱搜
留言列表
發表留言