buttons

MAMIBUSSOL

Board Regular
Joined
Jun 2, 2011
Messages
95
Hi folks

I currently have 12 sales worksheets each representing 1 months worth of sales ie JAN to DEC, I want to run a script which will request a date range and then using the date range select the appropriate month(sheets)

this will enable me to create a report of total sales for a set period rather then have to do this manually

I also want to run this from a button, which I currently am trying to create

any suggestions would be appreciated
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Welcome to the Forum,

I would think about using a UserForm where you can create a combobox to list the sheet names then when you select the correct name it will do the next thing you want it to. I am assuming from your question that the date range is a full months values?

If you need help reply to your thread.
 
Upvote 0
the sheet names are a month value, however the date range could be any time within a given month, as a result I am going to need to search through each sheet for any data within the given criteria.

Running the script isn't the issue, I have a button which will run the script, however I am trying to deal with the issues in small steps.

I believe the first step to my problem is to obtain the date range as a variable and move forward from there.
 
Upvote 0
I would still go down the userform route, as you can then use a date picker rather than have to type something in, You can assign actions based on the selected dates. Which version of Excel are you using as 2007 provides the date picker which can be added as an extra control.

To get you going first try this out.

Create a copy of your workbook, then open the copy. Look to record a macro on the first sheet and then use a filter and select a date range to filter by, once you have done that stop recording and then you have the basis of the code.

What is needed then is to then adjust the code so if you use the form it then needs to apply the range based on the date picker fields, once tested then you can look to use a For Each Worksheet command to apply the filter in each sheet in your workbook. Then you have to decide what do you want to do with the filtered data !

I hope this helps, post back with questions.
 
Upvote 0

Forum statistics

Threads
1,224,525
Messages
6,179,319
Members
452,905
Latest member
deadwings

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top