POInv macro w/ if then statement

G

Guest

i have a macro that runs when i press the big button (macro is in module).
macro does the following:
- saves a copy of the purchase order based on the po number and date stamp
- saves a copy on the hard drive
- emails a copy to accounts payable
- prints a copy for the actual invoice
- cleans the purchase order back to original state
- increases the po number by 1
- saves the new blank po

the date cell contains "[Ctrl] ;" - i want them to use that so the date is
entered in a preformatted condition and cannot be incorrect

i used the following code at the start of the macro
If .Range("M7") <> "[Ctrl] ;" Then
with End If at the end of the macro, but it does not work.

is there any other way to enter the current date into the macro so that M7
self populates when the macro is run.

- the code =today() cannot be used because the copy stored on the hard drive
keeps updating itself when the file is opened.

regards

jat
 
R

Roger Govier

Hi

You could use something like
Range("M7") = Format(date, "dd mmm yyyy")

Date in VBA will return the current date.

If you made your PO a Template, rather than a .xls file, you could save
yourself the task of
- cleans the purchase order back to original state
- saves the new blank po


--
Regards

Roger Govier


jatman said:
i have a macro that runs when i press the big button (macro is in
module).
macro does the following:
- saves a copy of the purchase order based on the po number and date
stamp
- saves a copy on the hard drive
- emails a copy to accounts payable
- prints a copy for the actual invoice
- cleans the purchase order back to original state
- increases the po number by 1
- saves the new blank po

the date cell contains "[Ctrl] ;" - i want them to use that so the
date is
entered in a preformatted condition and cannot be incorrect

i used the following code at the start of the macro
If .Range("M7") <> "[Ctrl] ;" Then
with End If at the end of the macro, but it does not work.

is there any other way to enter the current date into the macro so
that M7
self populates when the macro is run.

- the code =today() cannot be used because the copy stored on the hard
drive
keeps updating itself when the file is opened.

regards

jat
 
G

Guest

i try the template format sometime this month;

regards,

jat

Roger Govier said:
Hi

You could use something like
Range("M7") = Format(date, "dd mmm yyyy")

Date in VBA will return the current date.

If you made your PO a Template, rather than a .xls file, you could save
yourself the task of
- cleans the purchase order back to original state
- saves the new blank po


--
Regards

Roger Govier


jatman said:
i have a macro that runs when i press the big button (macro is in
module).
macro does the following:
- saves a copy of the purchase order based on the po number and date
stamp
- saves a copy on the hard drive
- emails a copy to accounts payable
- prints a copy for the actual invoice
- cleans the purchase order back to original state
- increases the po number by 1
- saves the new blank po

the date cell contains "[Ctrl] ;" - i want them to use that so the
date is
entered in a preformatted condition and cannot be incorrect

i used the following code at the start of the macro
If .Range("M7") <> "[Ctrl] ;" Then
with End If at the end of the macro, but it does not work.

is there any other way to enter the current date into the macro so
that M7
self populates when the macro is run.

- the code =today() cannot be used because the copy stored on the hard
drive
keeps updating itself when the file is opened.

regards

jat
 
G

Guest

code works, thank you

jat


Roger Govier said:
Hi

You could use something like
Range("M7") = Format(date, "dd mmm yyyy")

Date in VBA will return the current date.

If you made your PO a Template, rather than a .xls file, you could save
yourself the task of
- cleans the purchase order back to original state
- saves the new blank po


--
Regards

Roger Govier


jatman said:
i have a macro that runs when i press the big button (macro is in
module).
macro does the following:
- saves a copy of the purchase order based on the po number and date
stamp
- saves a copy on the hard drive
- emails a copy to accounts payable
- prints a copy for the actual invoice
- cleans the purchase order back to original state
- increases the po number by 1
- saves the new blank po

the date cell contains "[Ctrl] ;" - i want them to use that so the
date is
entered in a preformatted condition and cannot be incorrect

i used the following code at the start of the macro
If .Range("M7") <> "[Ctrl] ;" Then
with End If at the end of the macro, but it does not work.

is there any other way to enter the current date into the macro so
that M7
self populates when the macro is run.

- the code =today() cannot be used because the copy stored on the hard
drive
keeps updating itself when the file is opened.

regards

jat
 

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