ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   activate VBA (https://www.excelbanter.com/excel-programming/395679-re-activate-vba.html)

Gary''s Student

activate VBA
 
My sub should go in the worksheet code area, not the ThisWorkbook code area.

1. Erase my code from ThisWorkbook area
2. From Excel, right-click the tab at the bottom of the window and select
View Code
3. You should now be in the worksheet code area
4. Paste my stuff in

By the way, make sure your code is in a standard module and that it is not
Private.

--
Gary''s Student - gsnu200738


"geebee" wrote:

its not working. nothing is hapening. i made sur that the code is in the
ThisWorkBook section instead of a separate module. And I havea sub called
celltoast(). not a macro, but a sub. i even added a messagebox to the code
you gave me, but im not getting a messagebox to appear. what am i doing
wrong?

thanks in advance,
geebee


"Gary''s Student" wrote:

It is possible. Let's say your macro celltoast is in a standard module. Say
we want the macro called whenever cell Z100 is clicked.

In the worksheet code area enter:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Range("Z100")) Is Nothing Then
Exit Sub
End If
Application.EnableEvents = False
Call celltoast
Application.EnableEvents = True
End Sub


REMEMBER: the worksheet code area, not a standard module
--
Gary''s Student - gsnu200737


"geebee" wrote:


hi,

i would like to know how i can activate a VBA sub celltoast() when i click a
cell in MS excel. is this possible? if so, how?

thanks in advance,
geebee



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com