Pabilio
asked on
INSERT A ROW IN EXCEL SPREADSHEET DEPENDING ON CRITERIA
Hi,
Attached is a sample of the data that I´m working with....is a monthly store's sales resume.
Columna A have the date of sale ...column B have the invoice number...the other columns have details of the sale....one day could have more than one sale or none at all.
What I need is when I press a command button the code inserts a row when there is a day without sale, writing in column C: "NO SALE" ... and when is saturday or sunday (Shop closed) the code have to insert a row for each non workable day and write in column C: "NO WORKING DAY".
In the document attached, in sheet "hoja1" is how I have the data actually and in sheet "hoja2" is how I need it (The final result after the code runs)
I really appreciate your help with this.
Thank you for your time.
Roberto.
SAMPLE.xls
Attached is a sample of the data that I´m working with....is a monthly store's sales resume.
Columna A have the date of sale ...column B have the invoice number...the other columns have details of the sale....one day could have more than one sale or none at all.
What I need is when I press a command button the code inserts a row when there is a day without sale, writing in column C: "NO SALE" ... and when is saturday or sunday (Shop closed) the code have to insert a row for each non workable day and write in column C: "NO WORKING DAY".
In the document attached, in sheet "hoja1" is how I have the data actually and in sheet "hoja2" is how I need it (The final result after the code runs)
I really appreciate your help with this.
Thank you for your time.
Roberto.
SAMPLE.xls
ASKER
Hi Dave,
The code inserts the rows perfectly.
The problem is with the sentences "NO WORKING DAY" and "NO SALE".
In February 1 (which was Sunday) the code wrote "NO SALE". instead of NO WORKING DAY.
In February 6 (Friday) the code wrote "NO WORKING DAY" instead of NO SALE.
saturday 7 is ok "NO WORKING DAY"
Sunday 8 wrote "NO SALE" and then the next weekends, it does the same (looks like the code does not recognize Sunday as a NO working day).
With the exception of friday 6 when the code wrote NO WORKING DAY it manages fine the regular weekdays with the NO SALE sentence.
Thank you very much for your help.
Regards,
Roberto.
The code inserts the rows perfectly.
The problem is with the sentences "NO WORKING DAY" and "NO SALE".
In February 1 (which was Sunday) the code wrote "NO SALE". instead of NO WORKING DAY.
In February 6 (Friday) the code wrote "NO WORKING DAY" instead of NO SALE.
saturday 7 is ok "NO WORKING DAY"
Sunday 8 wrote "NO SALE" and then the next weekends, it does the same (looks like the code does not recognize Sunday as a NO working day).
With the exception of friday 6 when the code wrote NO WORKING DAY it manages fine the regular weekdays with the NO SALE sentence.
Thank you very much for your help.
Regards,
Roberto.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thank you Dave, it works perfectly.
I really appreciate your help.
Regards,
Roberto.
I really appreciate your help.
Regards,
Roberto.
No probs, thx for the grade Roberto :)
ASKER
Hi Dave,
hope you read this....
I got a problem when running the code in the original spreadsheet....could you check it ?
This is the new tread:
https://www.experts-exchange.com/questions/24242499/Help-fixing-VB-Code-in-EXCEL-spreadsheet-is-not-running-when-using-formulas-instead-of-values.html
Regards,
Roberto.
hope you read this....
I got a problem when running the code in the original spreadsheet....could you check it ?
This is the new tread:
https://www.experts-exchange.com/questions/24242499/Help-fixing-VB-Code-in-EXCEL-spreadsheet-is-not-running-when-using-formulas-instead-of-values.html
Regards,
Roberto.
It will prompt you for a start date which can be earlier than the 2-Feb-09 value (ie to insert your 1-Feb-09 value)
Cheers
Dave
Open in new window
SAMPLE-1----djb.xls