Wed 14 Nov 2007
Losing the Clipboard
Posted by pfitz under Technology, Libraries
Today I did a presentation at the ILF Annual Conference. It was about using Excel to track Reference statistics (and getting rid of the traditional clipboard). Attendees asked for the code to be made available online so they could copy and paste it rather than retyping all of it and risking mistyping one symbol and having it not work.
So here is the code. Right off my handouts. I welcome any questions you may have.
Reference Macro
Application.ScreenUpdating = False
Worksheets("Transactions").Activate
ActiveSheet.Range("a1").End(xlDown).Offset(1, 0).Select
ActiveCell.FormulaR1C1 = Date
ActiveCell.Offset(rowoffset:=0, columnoffset:=1).Activate
ActiveCell.FormulaR1C1 = Time
ActiveCell.Value = ActiveCell.Value - Int(ActiveCell.Value)
ActiveCell.Offset(rowoffset:=0, columnoffset:=1).Activate
ActiveCell.FormulaR1C1 = "1"
Application.CutCopyMode = False
ActiveSheet.Range("a1").Select
Worksheets("Main").Activate
response = MsgBox("Reference Transaction Logged", 64, "Thank you")
ActiveWorkbook.Save
Application.ScreenUpdating = True
General Macro
Application.ScreenUpdating = False
Worksheets("Transactions").Activate
ActiveSheet.Range("a1").End(xlDown).Offset(1, 0).Select
ActiveCell.FormulaR1C1 = Date
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell.FormulaR1C1 = Time
ActiveCell.Value = ActiveCell.Value - Int(ActiveCell.Value)
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell.FormulaR1C1 = "1"
Application.CutCopyMode = False
ActiveSheet.Range("A1").Select
Worksheets("General").Activate
ActiveSheet.Range("a1").End(xlDown).Offset(1, 0).Select
ActiveCell.FormulaR1C1 = Date
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell.FormulaR1C1 = "1"
Application.CutCopyMode = False
ActiveSheet.Range("A1").Select
Worksheets("MAIN").Activate
Response = MsgBox("Email Reference Transaction Logged", 64, "Thank you")
ActiveWorkbook.Save
Application.ScreenUpdating = True
Data Collection Code for 8:00 hour, first column
=SUM(IF(INDIRECT("'"&$H$1&"'!$B$3"):INDIRECT("'"&$H$1&"'!$B$"&COUNTA(INDIRECT("'"&$H$1&"'!$A:$A")))>=0.333, IF(INDIRECT("'"&$H$1&"'!$B$3"):INDIRECT("'"&$H$1&"'!$B$"&COUNTA(INDIRECT("'"&$H$1&"'!$A:$A")))<0.375, IF(INDIRECT("'"&$H$1&"'!C$3"):INDIRECT("'"&$H$1&"'!C$"&COUNTA(INDIRECT("'"&$H$1&"'!$A:$A")))=1,1,0))))
Data Collection Code for 9:00 hour, first column
=SUM(IF(INDIRECT("'"&$H$1&"'!$B$3"):INDIRECT("'"&$H$1&"'!$B$"&COUNTA(INDIRECT("'"&$H$1&"'!$A:$A")))>=0.375, IF(INDIRECT("'"&$H$1&"'!$B$3"):INDIRECT("'"&$H$1&"'!$B$"&COUNTA(INDIRECT("'"&$H$1&"'!$A:$A")))<0.416, IF(INDIRECT("'"&$H$1&"'!C$3"):INDIRECT("'"&$H$1&"'!C$"&COUNTA(INDIRECT("'"&$H$1&"'!$A:$A")))=1,1,0))))
Data Collection Code for 8:00 hour, second column
=SUM(IF(INDIRECT("'"&$H$1&"'!$B$3"):INDIRECT("'"&$H$1&"'!$B$"&COUNTA(INDIRECT("'"&$H$1&"'!$A:$A")))>=0.333, IF(INDIRECT("'"&$H$1&"'!$B$3"):INDIRECT("'"&$H$1&"'!$B$"&COUNTA(INDIRECT("'"&$H$1&"'!$A:$A")))<0.375, IF(INDIRECT("'"&$H$1&"'!D$3"):INDIRECT("'"&$H$1&"'!D$"&COUNTA(INDIRECT("'"&$H$1&"'!$A:$A")))=1,1,0))))
Averages Code for 8:00 hour, first column
=Totals!B3/IF(OR(LEFT($H$1,2)="01",LEFT($H$1,2)="03",LEFT($H$1,2)="05",LEFT($H$1,2)="07",LEFT($H$1,2)="08",LEFT($H$1,2)="10",LEFT($H$1,2)="12"),31,IF(LEFT($H$1,2)="02",28,30))
Averages Code for 9:00 hour, first column
=Totals!B4/IF(OR(LEFT($H$1,2)="01",LEFT($H$1,2)="03",LEFT($H$1,2)="05",LEFT($H$1,2)="07",LEFT($H$1,2)="08",LEFT($H$1,2)="10",LEFT($H$1,2)="12"),31,IF(LEFT($H$1,2)="02",28,30))
Averages Code for 8:00 hour, second column
=Totals!C3/IF(OR(LEFT($H$1,2)="01",LEFT($H$1,2)="03",LEFT($H$1,2)="05",LEFT($H$1,2)="07",LEFT($H$1,2)="08",LEFT($H$1,2)="10",LEFT($H$1,2)="12"),31,IF(LEFT($H$1,2)="02",28,30))
Formula for Title of Totals Page (cell A1)
="TOTAL REFERENCE TRANSACTIONS for "&TEXT(H1,"mmm yyyy")
Na
November 20th, 2007 at 16:48:19
Thank you for the information on your blog. I am trying to implement what I learn in your seminar to use for my local library. However, I am in need of more information. Please provide the formula for time in hour increments, i.e. 8-9, 9-10, etc. My library counts the number of people who enter the library during the hour. I hope this makes sense to you. Any help you provide will be much appreciated. Thanks.
February 14th, 2008 at 1:11:35
Many thanks for the macro Code!
February 21st, 2008 at 4:42:22
This sounds very interesting. I would like to see an example of the Excel, before trying to implementing it. Thanks.
February 21st, 2008 at 4:42:58
This sounds very interesting. I would like to see an example of the Excel file, before trying to implementing it. Thanks.
July 10th, 2008 at 2:43:38
This sounds very interesting indeed. I’m not much of a fan of the clipboard, to be honest, and would much rather prefer to use Excel. I’m sure this will add a lot of difference to the way things are working right now – and probably provide a lot more smoothness towards things. Looking forward to putting it into action and seeing what we come up with!
July 23rd, 2008 at 9:36:56
Wow! Super thank you!!! We’ve been waiting for this…at long last it’s here.