Macro Date Help

yogin2

New Member
Joined
Jun 7, 2008
Messages
41
Hi

I'm new to macros & vba, I have recorded a macro which will print off a selected area but the problem I'm have is how to change the date as I cannot get the macro recorder to ask for the user to enter the date.

Can anyone help me please.

Below is the macro. The date needs to be entered after this screen Sheets("Days Daily Sheet").Select

Sub OutloadingDays()
'
' OutloadingDays Macro
'
'
Sheets("Days Daily Sheet").Select
ActiveSheet.Range("$B$4:$D$86").AutoFilter Field:=3, Criteria1:="DL"
ActiveWindow.SelectedSheets.PrintPreview
ActiveWindow.SelectedSheets.PrintOut Copies:=1
Sheets("Macro's").Select
End Sub


Thanks

Yogin
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Yogin

Where does the date need to be entered?

In a cell, a header, a footer, for the autofilter?:)
 
Upvote 0
Yogin

Well you should be able to do that simply like this.
Code:
Sheets("Days Daily Sheet").Range("D2") = Date()
And you could probably lose the Select parts of your code.
Code:
Sub OutloadingDays()
'
' OutloadingDays Macro
'
'
With Sheets("Days Daily Sheet")
.Range("D2") = Date()
.Range("$B$4:$D$86").AutoFilter Field:=3, Criteria1:="DL"
.PrintOut Copies:=1
End With
 
End Sub
 
Upvote 0
Thanks Norie, This works fine.

What I was after was that once the macro is run after step one, a dialogue box appears and ask to enter a date, then run rest of the vba code to print.

Is this possible?

Yogin
 
Upvote 0

Forum statistics

Threads
1,214,566
Messages
6,120,262
Members
448,953
Latest member
Dutchie_1

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