ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need help with code (https://www.excelbanter.com/excel-programming/310318-need-help-code.html)

alexm999[_89_]

Need help with code
 
I have a macro that a user will run every day to gather information fro
another spreadsheet.

Right now the user has to delete the previous days info and run th
macro.
Is there a way I can have the macro test to see if the day of the wee
has changed, then to delete cells D3,D4,D5 & D6 and run the macro?

Also, i'd like to use the =now() function in the macro for cell A7 tha
when the macro runs, it tell the operator (sometimes a different person
when the program ran last?

thank

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

Need help with code
 
if the day of the week has changed from what? Are we comparing the day of
the week for today against the day of the week recorded where?

=Now will recalculate every time the sheet calculates - so it will change
every day (it isn't static). .

You can have your macro just put in the date as part of the work that it
does.

Worksheets("Sheet3").Range("A7").Value = Date

--
Regards,
Tom Ogilvy


"alexm999 " wrote in message
...
I have a macro that a user will run every day to gather information from
another spreadsheet.

Right now the user has to delete the previous days info and run the
macro.
Is there a way I can have the macro test to see if the day of the week
has changed, then to delete cells D3,D4,D5 & D6 and run the macro?

Also, i'd like to use the =now() function in the macro for cell A7 that
when the macro runs, it tell the operator (sometimes a different person)
when the program ran last?

thanks


---
Message posted from http://www.ExcelForum.com/




alexm999[_91_]

Need help with code
 
If the macro is run on Monday it will populate the cells, when the macro
is rerun on tuesday, i need Monday numbers to be deleted prior to the
macro running cause it can through the formula off..


---
Message posted from http://www.ExcelForum.com/


Tom Ogilvy

Need help with code
 
I thought that was the whole point of the question, to have the macro clear
the cells. If I run it on monday and check it on tuesday, the cells will be
populated. If I run it on Tuesday and check it on Wednesday, the cells will
be populated from Tuesday's run. Where is the difference? As I said what
do you want to check against.

If all you want to check against is that the cells are populated, why
bother, just clear them. If they are populated or not the results are the
same.

Range(D3:D6").Clearcontents



--
Regards,
Tom Ogilvy


"alexm999 " wrote in message
...
If the macro is run on Monday it will populate the cells, when the macro
is rerun on tuesday, i need Monday numbers to be deleted prior to the
macro running cause it can through the formula off..


---
Message posted from http://www.ExcelForum.com/





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

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