help needed with timer / loop

W

wendy_ia

I am creating a program currently using Ms Excel. I have created a for
that tracks the time (seconds/minutes). It is linked to a workshee
called settings, which shows the information and the time. Example:

====== Example =============

Information Time (seconds)
AAA 2
BBB 5
CCC 8
DDD 10
EEE 15
============================

The name of this worksheet is called "Settings". Now I am trying to ru
the form, with a textbox (name: txtTime) which shows the tim
(seconds). For example, when the form is activated it shows "2" on th
textbox, and after 2 seconds, it shows
"5", then after 5 seconds, it shows "8" and so on. I am trying to mak
a textbox (name: txtInfo) so when txtTime shows "2", txtInfo shoul
show "AAA", and when txtTime shows "5", txtInfo shows "BBB". However
am currently encountering problems
where the values of the textboxes would not "jump" after the specifie
seconds. My code currently is:


==== Code ==================

Private Sub UserForm_Activate()
Call LocateRecipe
End Sub

Private Sub LocateRecipe()

Dim currow As Integer
Dim curcol As Integer
Dim j As Integer
Dim x As String
Dim y As Integer

currow = 2
curcol = 4
j = 9

Dim c As Integer

Do While (ActiveSheet.Cells(currow, curcol).Value <> "") An
(ActiveSheet.Cells(currow, j).Value <> "END")
Dim i As String
i = 1

Dim x1 As String
Dim y1 As Integer

Sheets("Settings").Select
newactivecell = Cells(currow, curcol).Select
x1 = ActiveCell.Value

newactivecell = Cells(currow, curcol + i).Select
y1 = ActiveCell.Value

txtTime.Value = x1
txtInfo.Value = y1

c = y1 + c
currow = currow + 1

Application.OnTime Now + TimeValue("00:00:0" & c), "killtheform"

Loop

End Sub

==========================

Any ideas how to solve this? Thanks a lot!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top