I have a print routine that I want to add the current system date. Can anyone please tell me the code? Thanks
I have a print routine that I want to add the current system date. Can anyone please tell me the code? Thanks
Peace of mind is found in some of the strangest places.
Date() or now().
Or if you are printing the same worksheet and only some of the data is changing, you can putin the date cell and it will always be updated to the current system date.=Today()
Sorry, =now() is OK but gives the time as well , but date() is Not OK and will give an error message.
Use Format with Now() and you can present it as you wish.
Format(Now(), "dd MMMM yyyy")
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Just use either of these two, no parenthasis ...
Date 'Current system dateNote that the Date method will not have a time value associated with it; in other words it will be a whole (serial) number.Time 'Current system time
Regards, Zack Barresse
Check out the KB! :|: BOARD TAGS: WHAT ARE THEY AND HOW DO I USE THEM
What is a Microsoft MVP? | Free Microsoft Courses | My Book on Excel Tables
Hi Zack,
I have some headings I want repeated at the top of every page. What is the best way to accomplish this?
Public Sub PrintMtvGroupList() LastRow = Range("A65536").End(xlUp).Row Row = 3 Range("C1:G1").Font.Bold = "True" Range("C1").Value = "Group Name" Range("D1").Value = "Bill Rep" Range("E1").Value = "Ext." Range("F1").Value = "Group #" Range("G1").Value = "Back Up" For i = 1 To LastRow Step 6 Range("C" & Row).Value = Range("B" & i).Text Range("D" & Row).Value = Range("B" & i + 1).Text Range("E" & Row).Value = Range("B" & i + 2).Text Range("F" & Row).Value = Range("B" & i + 3).Text Range("G" & Row).Value = Range("B" & i + 4).Text Row = Row + 1 If Row = 40 Then Call PrintHeadings End If Next i Columns("C:G").PrintPreview Columns("C:G").ClearContents End Sub
Peace of mind is found in some of the strangest places.
With code? Set up a For Each ws In ActiveWorkbook.Worksheets loop.
Manually? Select the left-most sheet, press/hold Shift, select the right-most sheet, make your change in any sheet, right click any sheet tab, select Ungroup.
I prefer the manual way. You do it once, you're done. I'm lazy.
Regards, Zack Barresse
Check out the KB! :|: BOARD TAGS: WHAT ARE THEY AND HOW DO I USE THEM
What is a Microsoft MVP? | Free Microsoft Courses | My Book on Excel Tables
Just have one sheet. Would prefer code
Peace of mind is found in some of the strangest places.
I tried an approach where I was checking a counter I defined after each row was written but it never forced the routine to work....Here is my febile attempt..
Public Sub PrintMtvGroupList() LastRow = Range("A65536").End(xlUp).Row Row = 3 Range("C1:G1").Font.Bold = "True" Range("C1").Value = "Group Name" Range("D1").Value = "Bill Rep" Range("E1").Value = "Ext." Range("F1").Value = "Group #" Range("G1").Value = "Back Up" For i = 1 To LastRow Step 6 Range("C" & Row).Value = Range("B" & i).Text Range("D" & Row).Value = Range("B" & i + 1).Text Range("E" & Row).Value = Range("B" & i + 2).Text Range("F" & Row).Value = Range("B" & i + 3).Text Range("G" & Row).Value = Range("B" & i + 4).Text Row = Row + 1 If Row = 40 Then Call PrintHeadings End If Next i Columns("C:G").PrintPreview 'Columns("C:G").ClearContents End Sub Public Sub PrintHeadings() Range("C1:G1").Font.Bold = "True" Range("C1").Value = "Group Name" Range("D1").Value = "Bill Rep" Range("E1").Value = "Ext." Range("F1").Value = "Group #" Range("G1").Value = "Back Up" 'Row = 0 Row = 3 End Sub
Peace of mind is found in some of the strangest places.
Not sure what you mean Austen. If you only have one single Sheet, but have many pages and you have a single set of headers that you want repeated at the top of every printed page, then follow these steps ...
File (menu) --> Page Setup..
Sheet (tab)
Rows to Repeat at Top --> Select entire header rows --> Ok.
Is that what you are talking about?
Regards, Zack Barresse
Check out the KB! :|: BOARD TAGS: WHAT ARE THEY AND HOW DO I USE THEM
What is a Microsoft MVP? | Free Microsoft Courses | My Book on Excel Tables
Thanks Zack. We can mark this one solved.
Peace of mind is found in some of the strangest places.