Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default run macro upon clicking a cell?


I wrote a little macro (module, general) and at the moment it's runnin
on pressing ctr+q.

Now I wonder if it's possible to make it run everytime i click a cell.

Or if not so, then if it's possible to make it run like every
seconds.

Please note that this is my first excel macro, so i don't really kno
anything about macroes yet,

thx in advance,

the blue ride

--
theblueride
-----------------------------------------------------------------------
thebluerider's Profile: http://www.excelforum.com/member.php...fo&userid=3775
View this thread: http://www.excelforum.com/showthread.php?threadid=57339

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default run macro upon clicking a cell?

On selecting a cell

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "A1:H10"

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
'do your stuff
End With
End If

End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"thebluerider"
wrote in message
news:thebluerider.2csi5g_1155995408.9223@excelforu m-nospam.com...

I wrote a little macro (module, general) and at the moment it's running
on pressing ctr+q.

Now I wonder if it's possible to make it run everytime i click a cell.

Or if not so, then if it's possible to make it run like every 2
seconds.

Please note that this is my first excel macro, so i don't really know
anything about macroes yet,

thx in advance,

the blue rider


--
thebluerider
------------------------------------------------------------------------
thebluerider's Profile:

http://www.excelforum.com/member.php...o&userid=37754
View this thread: http://www.excelforum.com/showthread...hreadid=573391



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default run macro upon clicking a cell?


Paste this in to the worksheet code module. Every time you click a cell
on the worksheet it will call your macro

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Call YOUR MACRO NAME HERE
End Sub

Regards,
Simon


--
Simon Lloyd
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.excelforum.com/member.php...fo&userid=6708
View this thread: http://www.excelforum.com/showthread...hreadid=573391

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default run macro upon clicking a cell?


This could work, right click on the worksheets tab
select view codes
in the code window select worksheet from the drop down, in the dropdow
to the right select SelectionChange

place you macro code in the sub, when ever you change the selection o
the sheet the macro will kick in.
Use the code below as an example:

MsgBox "Macro goes here"




Private Sub Worksheet_SelectionChange(ByVal Target As Range)
MsgBox "Macro goes here"

End Su

--
davesexce

-----------------------------------------------------------------------
davesexcel's Profile: http://www.excelforum.com/member.php...fo&userid=3170
View this thread: http://www.excelforum.com/showthread.php?threadid=57339

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
How to Run a Macro from clicking a cell Romileyrunner1 Excel Worksheet Functions 11 September 20th 09 01:19 PM
Run a macro when clicking a cell. [email protected] Excel Worksheet Functions 9 May 7th 08 08:58 AM
Run a macro after clicking into cell Esradekan Excel Worksheet Functions 6 March 27th 08 10:34 PM
Launching a macro by double-clicking on active cell aca Excel Programming 5 August 4th 05 10:08 PM
Run macro from clicking on a cell jrd269 Excel Discussion (Misc queries) 2 June 3rd 05 09:35 PM


All times are GMT +1. The time now is 12:39 AM.

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

About Us

"It's about Microsoft Excel"