LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default I have a fix already, but would like to use what I've created here

I know why I'm getting the error, but I would like to know how to fix it.

The spreadsheet cells contain the following:

A1: StartDate
A2: 12/12/08
B1: EndDate
B2: 12/15/08
F1: StartTime (Unplanned)
F2: 12:20
G1: EndTime (Unplanned)
G2: 14:30
I1: TotalDowntime
I2: This cell is blank and where the end result of Main() will go.

________________________________
Sub Main()

Range("A1").Select

Cells.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=x1Next, _
MatchCase:=False).Activate

ActiveCell.Offset(-1, 8).Activate

startdate = ActiveCell.Offset(0, -8).Value
enddate = ActiveCell.Offset(0, -7).Value

daysdown = DateDiff("D", startdate, enddate)

starttime = ActiveCell.Offset(0, -3).Value
endtime = ActiveCell.Offset(0, -2).Value

hourdiff = starttime - endtime

daysvshours = daysdown * 24 & ":00:00"

totalhours = daysvshours - hourdiff <-------------Gives the error "Type
Mismatch (Error 13)"

ActiveCell.Value = totalhours

End Sub


__________________
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can such a macro be created? Jaleel Excel Discussion (Misc queries) 2 February 15th 10 12:02 PM
tab key use in a created template Audra Excel Discussion (Misc queries) 3 July 31st 08 12:27 AM
Created Date steph44haf Excel Worksheet Functions 3 May 12th 07 06:16 PM
Running VBA created in XL for Win on Mac kiloez Excel Discussion (Misc queries) 0 January 10th 06 07:51 PM
created objects look different ben Excel Programming 0 January 17th 05 06:37 PM


All times are GMT +1. The time now is 05:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"