![]() |
WorkBook Open & Sheet Activate
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. |
WorkBook Open & Sheet Activate
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 "jimmy" wrote: 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. |
All times are GMT +1. The time now is 10:59 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com