PC Review


Reply
Thread Tools Rate Thread

How do I implement this in Excel? Need programming tips.

 
 
WMR
Guest
Posts: n/a
 
      9th Mar 2007
I have an algorithm for a certain program. But I need help
implementing it in Excel. Here is my algorithm:

1. Take the start time (user inputted): ex. 10:03:05
2. Put it in column A, row 2
3. Add 9 seconds to start time: ex. 10:03:05 + 0:0:09 = 10:03:14
(new_time1)
4. Put new time in Column B, row 2
5. Write down "Event 1" in Column C, row 2.
6. Add 1 second to new_time1 (ex: 10:03:14): ex. 10:03:14 + 0:0:01 =
10:03:15 (new_time2)
7. Put new_time2 in column A, row 3.
8. Repeat steps 3 to 6 (incrementing new row in step 6) until end time
is reach (end time is hard coded).


Also, on step 5, I'd like to be able to change Event 1 to Event 2 for
each consecutive row.

Any tips?
TIA!

 
Reply With Quote
 
 
 
 
JE McGimpsey
Guest
Posts: n/a
 
      9th Mar 2007
One way:

Public Sub try()
Const dENDTIME As Double = #11:12:13#
Const dINC1 As Double = #00:00:09#
Const dINC2 As Double = #00:00:01#

Dim vResponse As Variant
Dim rCell As Range
Dim dTime As Double
Dim dTemp As Double
Dim dIncrement As Double

dIncrement = dINC1 + dINC2
On Error Resume Next
Do
vResponse = Application.InputBox( _
Prompt:="Enter Start Time:", _
Title:="try", _
Default:="00:00:00", _
Type:=2)
If vResponse = False Then Exit Sub 'user cancelled
dTime = TimeValue(vResponse)
Loop Until Err = 0
On Error GoTo 0
Set rCell = ActiveSheet.Range("A2")
For dTemp = dTime To dENDTIME Step dIncrement
With rCell.Resize(1, 2)
.Cells(1).Value = dTemp
.Cells(2).Value = dTemp + dINC1
.NumberFormat = "hh:mm:ss"
End With
Set rCell = rCell.Offset(1, 0)
Next dTemp
End Sub


In article <(E-Mail Removed)>,
"WMR" <(E-Mail Removed)> wrote:

> I have an algorithm for a certain program. But I need help
> implementing it in Excel. Here is my algorithm:
>
> 1. Take the start time (user inputted): ex. 10:03:05
> 2. Put it in column A, row 2
> 3. Add 9 seconds to start time: ex. 10:03:05 + 0:0:09 = 10:03:14
> (new_time1)
> 4. Put new time in Column B, row 2
> 5. Write down "Event 1" in Column C, row 2.
> 6. Add 1 second to new_time1 (ex: 10:03:14): ex. 10:03:14 + 0:0:01 =
> 10:03:15 (new_time2)
> 7. Put new_time2 in column A, row 3.
> 8. Repeat steps 3 to 6 (incrementing new row in step 6) until end time
> is reach (end time is hard coded).
>
>
> Also, on step 5, I'd like to be able to change Event 1 to Event 2 for
> each consecutive row.
>
> Any tips?
> TIA!

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Asynchronous Programming Model - how to implement? Dmitry Nogin Microsoft Dot NET Framework Forms 16 6th Mar 2007 01:34 PM
Asynchronous Programming Model - how to implement? Dmitry Nogin Microsoft Dot NET Framework 16 6th Mar 2007 01:34 PM
Need some general Tips and Tricks for programming ! =?Utf-8?B?QmlsbCBDYXNl?= Microsoft Excel Programming 11 29th Sep 2006 11:36 PM
Need some tips on how to implement a timer =?Utf-8?B?RmxhY2s=?= Microsoft C# .NET 5 27th Mar 2006 01:00 AM
Need Some Tips on How to Implement... =?Utf-8?B?RHJ5dmx5bmU=?= Microsoft Frontpage 8 16th Apr 2004 12:41 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:08 PM.