Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / January 2006

Tip: Looking for answers? Try searching our database.

How to auto run a macro in actived sheet?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tvnguye - 11 Jan 2006 16:26 GMT
Hello Excel professionals,
I have a sheet and a macro that I want that macro auto run when that sheet
is in active.  I looked in Help for AutoRunMacro, but I don't know how to do
for this macro.  My macro is just to change color in a correct cell when it
reads value from another cell that is like for example: $E$14.  The cells to
be changed color are different, but each time is just one cell.  Only one
cell is changed color.   How do I do?  Thank you in advance.
Tvnguye
Don Guillett - 11 Jan 2006 16:46 GMT
This is NOT very clear but you can do this sort of thing with a
worksheet_change event or a worksheet_selection event.

Signature

Don Guillett
SalesAid Software
dguillett1@austin.rr.com

> Hello Excel professionals,
> I have a sheet and a macro that I want that macro auto run when that sheet
[quoted text clipped - 7 lines]
> cell is changed color.   How do I do?  Thank you in advance.
> Tvnguye
Tvnguye - 11 Jan 2006 20:37 GMT
Hi Don,
Thank you for your responses, but not help yet.
I have a macro like this.  For example, in a Sheet2 I have a list box to
select a name in 4 names (from name1 to name4). Each name has a number.  
These names and numbers are in Sheet3.  I have a cell E90 in Sheet2 to show a
number of a name in list above.  I used Vlookup in cell E90, and I hid this
cell from users.  Each time I click in a list box to select a name, cell E90
will show a number.  I have other cells like J3=1 (for name1), J4=3 (for
name2), J5=8 (for name3), J6=10 (for name4).  These numbers are always shown
from J3 to J6.  The background of Sheet2 is in a color.  Each time I lick in
list box to select a name, for example: name1, cell E90 shows 1, and then I
want here is a in cells of column J will be highlighted background to light
blue. For example: (colorindex = 34).  So the users will pay attention to
highlighted cell with a number.
ActiveCell.Interior.ColorIndex = 34
I have a macro to change background color of  each cell of J, but I have to
run that macro by myself.  I want that macro run automatically each time I
click a name in a list box.  How do I do?  Thanks.

> This is NOT very clear but you can do this sort of thing with a
> worksheet_change event or a worksheet_selection event.
[quoted text clipped - 10 lines]
> > cell is changed color.   How do I do?  Thank you in advance.
> > Tvnguye
Dave Peterson - 11 Jan 2006 16:47 GMT
I don't think I'd use a macro to do this.

Have you considered format|Conditional formatting?

> Hello Excel professionals,
> I have a sheet and a macro that I want that macro auto run when that sheet
[quoted text clipped - 4 lines]
> cell is changed color.   How do I do?  Thank you in advance.
> Tvnguye

Signature

Dave Peterson

Tvnguye - 11 Jan 2006 20:35 GMT
Hi Dave,
Thank you for your responses, but not help yet.
I have a macro like this.  For example, in a Sheet2 I have a list box to
select a name in 4 names (from name1 to name4). Each name has a number.  
These names and numbers are in Sheet3.  I have a cell E90 in Sheet2 to show a
number of a name in list above.  I used Vlookup in cell E90, and I hid this
cell from users.  Each time I click in a list box to select a name, cell E90
will show a number.  I have other cells like J3=1 (for name1), J4=3 (for
name2), J5=8 (for name3), J6=10 (for name4).  These numbers are always shown
from J3 to J6.  The background of Sheet2 is in a color.  Each time I lick in
list box to select a name, for example: name1, cell E90 shows 1, and then I
want here is a in cells of column J will be highlighted background to light
blue. For example: (colorindex = 34).  So the users will pay attention to
highlighted cell with a number.
ActiveCell.Interior.ColorIndex = 34
I have a macro to change background color of  each cell of J, but I have to
run that macro by myself.  I want that macro run automatically each time I
click a name in a list box.  How do I do?  Thanks.

> I don't think I'd use a macro to do this.
>
[quoted text clipped - 8 lines]
> > cell is changed color.   How do I do?  Thank you in advance.
> > Tvnguye
Dave Peterson - 11 Jan 2006 21:15 GMT
Your listbox is from the Forms toolbar.

You can use a formula that uses that linked cell:
=if(e90="","",index(sheet1!a1:A4,e90))
(I used sheet1!a1:A4 is the home for the names)

Then I can use this cell in my format|conditional formatting dialog.

You may find that it's a little easier using data|validation.  Then you can dump
the linked cell and the additional cell with the formula.

> Hi Dave,
> Thank you for your responses, but not help yet.
[quoted text clipped - 31 lines]
> >
> > Dave Peterson

Signature

Dave Peterson

Tvnguye - 12 Jan 2006 00:35 GMT
Hi Dave,
You misunderstood my question.  I don't want to change value of J3:J6, but I
want to change background color of it when its value = E14.  For example, if
E14 = 1, background color of J3 will be changed to light blue, because J3 is
always = 1.  If E14 change to another number, J3 will return its old
background color, and another J will be changed background color.  So I don't
know how to do yet.  I just know how to run in a macro, but macro cannot be
auto run.
Thank you.

> Your listbox is from the Forms toolbar.
>
[quoted text clipped - 42 lines]
> > >
> > > Dave Peterson
Dave Peterson - 12 Jan 2006 00:50 GMT
That sounds like you want to use format|Conditional formatting.

If you use another cell to show the value of the name selected in the listbox,
you can use that cell in the conditional formatting expression.

But I'm confused about where the formulas are, where the original list is and
where the cells to change colors are.

Maybe you could try again.

> Hi Dave,
> You misunderstood my question.  I don't want to change value of J3:J6, but I
[quoted text clipped - 56 lines]
> >
> > Dave Peterson

Signature

Dave Peterson

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.