Archive for January, 2008

Formula for Date/Time Subtraction in Excel

Wednesday, January 23rd, 2008

This formula will show the difference (in hours) between two cells with date/time values. =IF(INT(B2)-INT(A2)<1,24*(mod(b2,1)-mod(a2,1)),((int(b2)-int(a2))*24)+24*(mod(b2,1)-mod(a2,1))) Press Ctrl-1 to format the cell, on the Number tab choose "Custom," enter this format: ####.0# "hours" The cell will show the number of hours passed between both dates/times, neatly formatted with a custom format displaying the word "hours" in the cell. For example, suppose you have "1/12/2008 10:30 AM" in cell A2 and "1/13/08 11:00 AM" in cell B2 in the same worksheet. The ...

Outlook VBA Code to Check Mail Size

Tuesday, January 22nd, 2008

This code, run on the currently open mail item, will display a message box giving you the size of the email in kilobytes. [sourcecode language='vb'] Sub CheckMailSize() Dim CurrentMsg As Outlook.MailItem On Error Resume Next Set CurrentMsg = ActiveInspector.CurrentItem On Error Goto 0 If (CurrentMsg Is Nothing) Or (TypeName(CurrentMsg) "MailItem") Then MsgBox "Double-click on a message first." Exit Sub End If MsgBox "This message is " & CurrentMsg.Size & " kb." Set CurrentMsg = Nothing End ...

MS KB Articles added to VBA Search Engine

Tuesday, January 22nd, 2008

I added a lot of KB articles to the custom search engine, it is now 200 sites! Try it out and let me know how it works. http://www.codeforexcelandoutlook/searchbox.html Take care, JP

My first Access macro

Friday, January 18th, 2008

I wrote my first Access macro today! Now, I am not a big fan of Access, but unfortunately I have to use it at work because it is the first choice for most people looking for a db (short for "database") program. For most situations, I prefer Excel. At work I have to import data from Excel to Access. Being as lazy as I am, I always try to find an easy way to do things. ...

My first blog!

Thursday, January 17th, 2008

Hello.That's it?Well, it's my first blog and my first post to my first blog. So it will be a bit boring. What I can promise you is that this website will only continue to grow with more code samples, formulas, links and other goodies. Eventually I would like to build a forum/posting area. If you have any thoughts, let me know.Talk soon,JP