Changing number of input boxes???

S

srroduin

I have the following code. The user puts in start date/time and stop
date/time. I am trying to get it so that it will prompt the user with start
time, stop time, and MW amount input boxes for every hour between the initial
and final start stop times.

For example initial start time is 11:00 and final stop time is 15:00 I want
it to have input boxes for 12:00, 13:00 and 14:00. I don't know how to do
this since the number of input boxes will change with the amount of time
before initial start and final stop.

How do I do this????? I appreciate any help I can get. Thx.


Private Sub Hourly_Click()
Dim rng As Range

Set rng = ActiveSheet.Cells(Rows.count, "A").End(xlUp).Offset(1, 0)
rng.Value = InputBox("Enter start date mm/dd/yyyy")
With rng.Offset(0, 1)
.Value = InputBox("Enter initial start time 24-hour clock")
.Value = .Value + TimeSerial(1, 0, 0)
End With
rng.Offset(0, 2).Value = InputBox("Enter stop date mm/dd/yyyy")
With rng.Offset(0, 3)
.Value = InputBox("Enter final stop time 24-hour clock")
.Value = .Value + TimeSerial(1, 0, 0)
End With
rng.Offset(0, 4).Value = InputBox("Enter MW Amount")

rng.Offset(0, 5).Value = InputBox("Enter TSN to increase")
rng.Offset(0, 6).Value = InputBox("Enter TSN to decrease")
Set rng = Nothing

End Sub
 

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