WorkBook Open & Sheet Activate

J

jimmy

Hi all,

There is only one sheet in my workbook, a cell in that sheet usually
assigned a date value - NOW(in coding, not the formula =NOW()). I wrote some
codes for changing different rows background color according to that date
(weekday). For testing purpose, sometimes I manually change the date in that
cell.

My problem is, my intention is write the code:
Sheets("ABC").Range("S1") = Now
in the Workbook open function and write the changing color code in the sheet
activate function. But it didn't work. Now, I have written two set of code
that one in the Workbook open function (date for now) and one in the
commandbutton in the sheet (press that button to get the cell "S1" value and
do the same thing). How can I do it for only has one set of code so easier
for amendment?

Furthermore, how to declare a function and what is the keyword for calling
that function?

Thank you.
 
G

Guest

Take a look at the limitations of a function before you use functions for
this.

http://www.ozgrid.com/VBA/Functions.htm

You could call another procedure from within the Workbook_Open and any other
procedure. I generally use "CALL Procedurename" because I often have
arguments that I'm passing between procedures.

HTH,
Barb Reinhardt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top