![]() |
looping question
i am trying to create a loop with for and next statements. i have 12 sheets,
one for each month i want to have the user select the month from the dropdown, build a report using that month as the end month and create a report giving totals for that period. for example, i set an sname variable jan, sname variable to feb. when the dropdown = jan it sets the cnt variable to 1, . when the dropdown = feb it sets the cnt variable to 2, and an if statement sets the sname to feb so if the dropdown = jan it goes to the jan sheet and copies and adds the values to the report sheet. if the dropdown = feb it goes to the feb sheet, copies the data, changes the counter by one and is supposed to set the cnt variable to 1 less than it was, 1 instead of 2. if it get it to loop, it always copies the same month for whatever the cnt variable is. if i choose april, i get the totals from april 4 times, may 5 times an so on. i am having a hard time with the next statement choosing the next sheet. i think i have variables for each month correctly set up, i just need help telling the script to goto the next sheet after if finished copying the sheet it's on. hopefully you can understand, if it's too involved, please don't waste your time writing a lot of code -- Gary |
looping question
i think i have it figured out
-- Gary "Gary Keramidas" wrote in message ... i am trying to create a loop with for and next statements. i have 12 sheets, one for each month i want to have the user select the month from the dropdown, build a report using that month as the end month and create a report giving totals for that period. for example, i set an sname variable jan, sname variable to feb. when the dropdown = jan it sets the cnt variable to 1, . when the dropdown = feb it sets the cnt variable to 2, and an if statement sets the sname to feb so if the dropdown = jan it goes to the jan sheet and copies and adds the values to the report sheet. if the dropdown = feb it goes to the feb sheet, copies the data, changes the counter by one and is supposed to set the cnt variable to 1 less than it was, 1 instead of 2. if it get it to loop, it always copies the same month for whatever the cnt variable is. if i choose april, i get the totals from april 4 times, may 5 times an so on. i am having a hard time with the next statement choosing the next sheet. i think i have variables for each month correctly set up, i just need help telling the script to goto the next sheet after if finished copying the sheet it's on. hopefully you can understand, if it's too involved, please don't waste your time writing a lot of code -- Gary |
All times are GMT +1. The time now is 12:46 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com