PC Review


Reply
Thread Tools Rate Thread

Activate macro after clicking on a particular cell

 
 
=?Utf-8?B?TW9pc2Vz?=
Guest
Posts: n/a
 
      7th Sep 2007
What do I have to code in order to call a macro after a select, or clikc on a
paricular cell?, for example, I would like to run the macro after a select
the cell A10 or a range of cells that have a format of merge so they look
like a big cell ?
Thanks
--
Moises
 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      7th Sep 2007
Which is it: A10 or a range of cells that have a format of merge so they
look like a big cell?

--
Regards,
Tom Ogilvy


"Moises" wrote:

> What do I have to code in order to call a macro after a select, or clikc on a
> paricular cell?, for example, I would like to run the macro after a select
> the cell A10 or a range of cells that have a format of merge so they look
> like a big cell ?
> Thanks
> --
> Moises

 
Reply With Quote
 
=?Utf-8?B?bXdhbTQyMw==?=
Guest
Posts: n/a
 
      7th Sep 2007
hi tom, i've got same question as moises, how can i start macro once a cell,
with a pulldown list, has a value entered?

"Tom Ogilvy" wrote:

> Which is it: A10 or a range of cells that have a format of merge so they
> look like a big cell?

 
Reply With Quote
 
=?Utf-8?B?TW9pc2Vz?=
Guest
Posts: n/a
 
      7th Sep 2007
I have both cases, one with a single cell like A10, and the second case a
range of cells with a merge format so they are displayed as a big cell (for
example range b2..d3, with a merge format).
Thanks
--
Moises


"Tom Ogilvy" wrote:

> Which is it: A10 or a range of cells that have a format of merge so they
> look like a big cell?
>
> --
> Regards,
> Tom Ogilvy
>
>
> "Moises" wrote:
>
> > What do I have to code in order to call a macro after a select, or clikc on a
> > paricular cell?, for example, I would like to run the macro after a select
> > the cell A10 or a range of cells that have a format of merge so they look
> > like a big cell ?
> > Thanks
> > --
> > Moises

 
Reply With Quote
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      7th Sep 2007
Right click on the sheet tab and select view code and put in code like this

Private Sub Worksheet_Change(ByVal Target As Range)
Set rng = Target.MergeArea
Select Case rng.Address(0, 0)
Case "A10"

Case "B23"

End Select
End Sub

then call the procedures within the case statements or put your code there.

--
Regards,
Tom Ogilvy


"Moises" wrote:

> I have both cases, one with a single cell like A10, and the second case a
> range of cells with a merge format so they are displayed as a big cell (for
> example range b2..d3, with a merge format).
> Thanks
> --
> Moises
>
>
> "Tom Ogilvy" wrote:
>
> > Which is it: A10 or a range of cells that have a format of merge so they
> > look like a big cell?
> >
> > --
> > Regards,
> > Tom Ogilvy
> >
> >
> > "Moises" wrote:
> >
> > > What do I have to code in order to call a macro after a select, or clikc on a
> > > paricular cell?, for example, I would like to run the macro after a select
> > > the cell A10 or a range of cells that have a format of merge so they look
> > > like a big cell ?
> > > Thanks
> > > --
> > > Moises

 
Reply With Quote
 
=?Utf-8?B?U2VsZi1DYWxsaW5nIFByb2JsZW0=?=
Guest
Posts: n/a
 
      27th Sep 2007
I have a similar issue. I tried the solution listed here and it worked... a
little too well. In the Private Sub Worksheet_Change(ByVal Target as Range)
(I'm not clear on what the ByVal Target as Range does,) the macro makes
changes to the worksheet. Specifically, it inserts a row in the current
worksheet and copies some formulas from an adjacent row.
The problem with this is that the Private Sub is calling itself when it
makes the change since the Sub causes the change that activates itself. This
sends the macro into an infinite loop whenever I make a change and I have to
ctrl+break to regain control. The macro stops in the middle of execution and
restarts. Any ideas on how to make the macro only execute once or only
execute when the user makes the change instead of the macro?

"Tom Ogilvy" wrote:

> Right click on the sheet tab and select view code and put in code like this
>
> Private Sub Worksheet_Change(ByVal Target As Range)
> Set rng = Target.MergeArea
> Select Case rng.Address(0, 0)
> Case "A10"
>
> Case "B23"
>
> End Select
> End Sub
>
> then call the procedures within the case statements or put your code there.
>
> --
> Regards,
> Tom Ogilvy
>
>
> "Moises" wrote:
>
> > I have both cases, one with a single cell like A10, and the second case a
> > range of cells with a merge format so they are displayed as a big cell (for
> > example range b2..d3, with a merge format).
> > Thanks
> > --
> > Moises
> >
> >
> > "Tom Ogilvy" wrote:
> >
> > > Which is it: A10 or a range of cells that have a format of merge so they
> > > look like a big cell?
> > >
> > > --
> > > Regards,
> > > Tom Ogilvy
> > >
> > >
> > > "Moises" wrote:
> > >
> > > > What do I have to code in order to call a macro after a select, or clikc on a
> > > > paricular cell?, for example, I would like to run the macro after a select
> > > > the cell A10 or a range of cells that have a format of merge so they look
> > > > like a big cell ?
> > > > Thanks
> > > > --
> > > > Moises

 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      27th Sep 2007
Have a look in the vba help index for
enableevents


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"Self-Calling Problem" <Self-Calling (E-Mail Removed)>
wrote in message newsBC1DDE5-C845-464C-BE28-(E-Mail Removed)...
>I have a similar issue. I tried the solution listed here and it worked... a
> little too well. In the Private Sub Worksheet_Change(ByVal Target as
> Range)
> (I'm not clear on what the ByVal Target as Range does,) the macro makes
> changes to the worksheet. Specifically, it inserts a row in the current
> worksheet and copies some formulas from an adjacent row.
> The problem with this is that the Private Sub is calling itself when it
> makes the change since the Sub causes the change that activates itself.
> This
> sends the macro into an infinite loop whenever I make a change and I have
> to
> ctrl+break to regain control. The macro stops in the middle of execution
> and
> restarts. Any ideas on how to make the macro only execute once or only
> execute when the user makes the change instead of the macro?
>
> "Tom Ogilvy" wrote:
>
>> Right click on the sheet tab and select view code and put in code like
>> this
>>
>> Private Sub Worksheet_Change(ByVal Target As Range)
>> Set rng = Target.MergeArea
>> Select Case rng.Address(0, 0)
>> Case "A10"
>>
>> Case "B23"
>>
>> End Select
>> End Sub
>>
>> then call the procedures within the case statements or put your code
>> there.
>>
>> --
>> Regards,
>> Tom Ogilvy
>>
>>
>> "Moises" wrote:
>>
>> > I have both cases, one with a single cell like A10, and the second case
>> > a
>> > range of cells with a merge format so they are displayed as a big cell
>> > (for
>> > example range b2..d3, with a merge format).
>> > Thanks
>> > --
>> > Moises
>> >
>> >
>> > "Tom Ogilvy" wrote:
>> >
>> > > Which is it: A10 or a range of cells that have a format of merge so
>> > > they
>> > > look like a big cell?
>> > >
>> > > --
>> > > Regards,
>> > > Tom Ogilvy
>> > >
>> > >
>> > > "Moises" wrote:
>> > >
>> > > > What do I have to code in order to call a macro after a select, or
>> > > > clikc on a
>> > > > paricular cell?, for example, I would like to run the macro after a
>> > > > select
>> > > > the cell A10 or a range of cells that have a format of merge so
>> > > > they look
>> > > > like a big cell ?
>> > > > Thanks
>> > > > --
>> > > > Moises


 
Reply With Quote
 
=?Utf-8?B?V2FsdCBIZXJtYW4=?=
Guest
Posts: n/a
 
      23rd Oct 2007
Tom,
How far away am I from getting this to work? I try and avoid macros at all
costs and I am now knee deep in this. Can you spare a moment to advise? I am
trying to get a calendar form to appear when a user selects either cell B9 Or
Cell C9 in the concerned worksheet....Thanks in advance for whatever advice
you can supply...

Walt

"Tom Ogilvy" wrote:

> Right click on the sheet tab and select view code and put in code like this
>
> Private Sub Worksheet_Change(ByVal Target As Range)
> Set rng = Target.MergeArea
> Select Case rng.Address(0, 0)
> Case "A10"
>
> Case "B23"
>
> End Select
> End Sub
>
> then call the procedures within the case statements or put your code there.
>
> --
> Regards,
> Tom Ogilvy
>
>
> "Moises" wrote:
>
> > I have both cases, one with a single cell like A10, and the second case a
> > range of cells with a merge format so they are displayed as a big cell (for
> > example range b2..d3, with a merge format).
> > Thanks
> > --
> > Moises
> >
> >
> > "Tom Ogilvy" wrote:
> >
> > > Which is it: A10 or a range of cells that have a format of merge so they
> > > look like a big cell?
> > >
> > > --
> > > Regards,
> > > Tom Ogilvy
> > >
> > >
> > > "Moises" wrote:
> > >
> > > > What do I have to code in order to call a macro after a select, or clikc on a
> > > > paricular cell?, for example, I would like to run the macro after a select
> > > > the cell A10 or a range of cells that have a format of merge so they look
> > > > like a big cell ?
> > > > Thanks
> > > > --
> > > > Moises

 
Reply With Quote
 
=?Utf-8?B?V2FsdCBIZXJtYW4=?=
Guest
Posts: n/a
 
      23rd Oct 2007
oops:

Private Sub Worksheet_Change(ByVal Target As Range)
Set rng = Target.MergeArea
Select Case rng.Address(0, 0)
Case "B9"
Sub OpenCalendar()
' Displays the UserForm and calendar
' Shortcuts should be made to this procedure
End If

Case "C9"
Sub OpenCalendar()
End Sub
"Tom Ogilvy" wrote:

> Right click on the sheet tab and select view code and put in code like this
>
> Private Sub Worksheet_Change(ByVal Target As Range)
> Set rng = Target.MergeArea
> Select Case rng.Address(0, 0)
> Case "A10"
>
> Case "B23"
>
> End Select
> End Sub
>
> then call the procedures within the case statements or put your code there.
>
> --
> Regards,
> Tom Ogilvy
>
>
> "Moises" wrote:
>
> > I have both cases, one with a single cell like A10, and the second case a
> > range of cells with a merge format so they are displayed as a big cell (for
> > example range b2..d3, with a merge format).
> > Thanks
> > --
> > Moises
> >
> >
> > "Tom Ogilvy" wrote:
> >
> > > Which is it: A10 or a range of cells that have a format of merge so they
> > > look like a big cell?
> > >
> > > --
> > > Regards,
> > > Tom Ogilvy
> > >
> > >
> > > "Moises" wrote:
> > >
> > > > What do I have to code in order to call a macro after a select, or clikc on a
> > > > paricular cell?, for example, I would like to run the macro after a select
> > > > the cell A10 or a range of cells that have a format of merge so they look
> > > > like a big cell ?
> > > > Thanks
> > > > --
> > > > Moises

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to activate macro from cell artzuka Microsoft Excel Misc 2 6th Jan 2009 09:12 PM
Event Macro - On Cell Activate - Change Cell Format Bob@1800-mail.com Microsoft Excel Programming 7 7th Nov 2007 03:36 AM
Activate code by clicking in cell =?Utf-8?B?ZXhwZWN0X2Vk?= Microsoft Excel Programming 3 7th Aug 2007 04:40 PM
Macro to activate cell =?Utf-8?B?TUVBRDU0MzI=?= Microsoft Excel Programming 2 20th Jul 2007 05:36 PM
activate a cell value through a macro =?Utf-8?B?VFVOR0FOQSBLVVJNQSBSQUpV?= Microsoft Excel Misc 1 10th Nov 2005 08:48 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:36 PM.