windwardmi
Board Regular
- Joined
- Oct 18, 2009
- Messages
- 138
Working on a project to design a report populated from data entries on the worksheets between certain dates. The following code is not finished but working in many ways. I am having issues finding the correct code to format the heading entry. In particular the font size for line 1 of the center header should be 20pts and line 2 14 pts.
Also the return Chr(13) creates to large a space between lines. How can that be reduced. Replacing Chr(13) with Chr(11) shows a box after line 1 when used.
Any suggestions or place I can go to see all formatting example of VBA to format headers?
Also the return Chr(13) creates to large a space between lines. How can that be reduced. Replacing Chr(13) with Chr(11) shows a box after line 1 when used.
Any suggestions or place I can go to see all formatting example of VBA to format headers?
Code:
Sub TimeSheet()
'
' TimeSheet Macro
'
' Keyboard Shortcut: Ctrl+t
'
Dim WS As Worksheet
Dim rightsheet As String
Dim StartDate As Date, EndDate As Date
StartDate = Application.InputBox("Start Date?")
EndDate = Application.InputBox("End Date?")
ActiveSheet.PageSetup.CenterHeader = "&12" & rightsheet & Chr(10) & ActiveSheet.Name & Chr(13) & rightsheet & Chr(10) & (StartDate) & " To " & (EndDate)
rightsheet = Application.InputBox("Employee Last Name?")
Sheets(rightsheet).Select
Selection.AutoFilter
ActiveSheet.Range("$A$1").CurrentRegion.AutoFilter Field:=1, Criteria1:=">=" & CLng(StartDate), _
Operator:=xlAnd, Criteria2:="<=" & CLng(EndDate)
'ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
'IgnorePrintAreas:=False
End Sub