+ Reply to Thread
Results 1 to 2 of 2

Varying parameters in IF statements: negative time

  1. #1
    Registered User
    Join Date
    03-02-2011
    Location
    Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    5

    Varying parameters in IF statements: negative time

    Hello I am currently stumped on trying to get an IF statement with varying parameters working. I just started VBA programming yesterday so the program is quite brute force. The last FOR loop in my code with the embedded IF statement I am trying to simulate this command: =IF(AO3>B3, B3+1-AO3, B3-AO3) which seems to not work in VBA. I am trying to subtract 7 hours from a 24 hour clock, it works on times that end up positive but spits out times that are negative (using 1904 time).

    Please Login or Register  to view this content.
    I have also tried substituting "AO" & j and "B" & j with Cells(41,j).value and Cells(2,j).value but I started getting 1002 errors.

    Any help would be appreciated!

    -karl

  2. #2
    Registered User
    Join Date
    03-02-2011
    Location
    Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Varying parameters in IF statements: negative time

    I will clarify the problem I am having: I want the if statement to increment the column number. So it starts at AO3 > B3, then next iteration it starts at AO4 > B4. etc.

    If a time in GMT (hh:mm:ss) is 00:00:00 then I subtract 7:00:00, I want to get 17:00:00

    Thanks!
    Attached Images Attached Images

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1