Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default help with looping dates

Help, this is driving me crazy.

So far I have the User typing in the start (column A) and the final date
(column K).
I need to loop it so that eventually every date between the start and final
will show up in Column A as a new start date and as the end date for the day
above (column B). It will continue to loop until the new start date = the
final date of the outage in Column K. I either get an endless loop or get
errors. Any help is much appreciated. The code for this is the DailySAS at
the bottom. The first start date and the final date come from the OutageSAS
code just below. Thanks!


Sub OutageSAS()
Dim SASStart As String
Dim SASEnd As String
Dim rng As Range


Set rng = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
SASIncrease = InputBox("Input the SAS # you want to increase, e.g. 11003")
SASDecrease = InputBox("Input the SAS # you want to decrease, e.g. 11006")
SASMW = InputBox("Enter new MW Amount")

rng.Offset(4, 0).Value = InputBox("Enter start date mm/dd/yyyy of event")


rng.Offset(4, 10).Value = InputBox("Enter stop date mm/dd/yyyy")


Set rng = Nothing

WkshtName = ActiveSheet.Name

Application.ScreenUpdating = False
Application.DisplayAlerts = False

Set wks1 = Workbooks("SAS Excel File111.xls").Worksheets(WkshtName)
Set wks2 = Workbooks("SAS Excel File111.xls").Worksheets("SAS UPLOAD")
Set wks3 = Workbooks("SAS Excel File111.xls").Worksheets("Outage")

Call GetName

SASType = InputBox("Enter the Type of SAS As Shown in example, e.g.
daily,hourly,flat")

If SASType = "daily" Then

Call DailySAS
Else
If SASType = "hourly" Then
'Call HourlySAS

Else
SASType = "flat"


End If
End If

End Sub

Sub DailySAS()
Dim rng As Range

Range("A5").Value = "Start Date"
Range("C5").Value = "Stop Date"
Range("E5").Value = "SAS Increased"
Range("E6" & i).Value = SASIncrease
Range("G5").Value = "SAS Decreased"
Range("G6" & i).Value = SASDecrease
Range("I5").Value = "MW Amount"
Range("I6" & i).Value = SASMW
Range("K5").Value = "Final Date of Outage"

Set rng = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)

rng.Value = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Value + 1

End Sub
Reply
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
Looping Buffyslay Excel Programming 1 February 1st 06 05:57 PM
Looping Hannes Excel Programming 3 December 27th 04 09:03 PM
Looping Gusset Gadder Excel Programming 2 December 11th 04 09:16 PM
Looping [email protected] Excel Programming 0 October 31st 03 07:47 PM
Looping J.E. McGimpsey Excel Programming 0 October 29th 03 11:09 PM


All times are GMT +1. The time now is 03:40 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"