Help with my procedure

D

Daviv

Below is my procedure which I want it to 1) download the weather from the
web, 2) copy the information onto column a:d, and 3) format the row (from
column a and d) if certain conditions are met in column c. My questions are:

1) It will not run at the scheduled time. For example, it will not run when
it is 7:30 am, 8:30 am, not at all. It was running before. Did I disable
something?
2) I am trying to highlight the selection if there is rain or showers? For
example, highlight the row 3 (from column a:d) since cell c3 show rain. It
is not working.
a b c d
1 Date Time Condition Temperature
2 01/05/07 1:30 Clear 70
3 01/05/07 2:30 Rain 80

3) I put the computer to sleep everyday at 3:30 when I go home, and activate
the computer everyday at 7:00 am. What I like is to have this procedure to
run daily automatically after I activate the computer, without actions on my
part such as opening the workbook. Would leaving the workbook open work?

-- Sub sfweather()

Dim ws As Worksheet
Set ws = Worksheets("weather")

Nameofthisprocedure = "sfweather"

Application.OnTime earliesttime:=TimeValue("7:05 am"),
procedure:="sfweather", Latesttime:=("7:10 am")
Application.OnTime earliesttime:=TimeValue("7:30 am"),
procedure:="sfweather", Latesttime:=("7:35 am")
Application.OnTime earliesttime:=TimeValue("8:30 am"),
procedure:="sfweather", Latesttime:=("8:35 am")
Application.OnTime earliesttime:=TimeValue("9:30 am"),
procedure:="sfweather", Latesttime:=("9:35 am")
Application.OnTime earliesttime:=TimeValue("10:30 am"),
procedure:="sfweather", Latesttime:=("10:35 am")
Application.OnTime earliesttime:=TimeValue("11:30 am"),
procedure:="sfweather", Latesttime:=("11:35 am")
Application.OnTime earliesttime:=TimeValue("12:30 pm"),
procedure:="sfweather", Latesttime:=("12:35 pm")
Application.OnTime earliesttime:=TimeValue("1:30 pm"),
procedure:="sfweather", Latesttime:=("1:35 pm")
Application.OnTime earliesttime:=TimeValue("2:30 pm"),
procedure:="sfweather", Latesttime:=("2:35 pm")
Application.OnTime earliesttime:=TimeValue("3:30 pm"),
procedure:="sfweather", Latesttime:=("3:35 pm")

ws.Range("f3").QueryTable.Refresh BackgroundQuery:=False


nextrow = ws.Range("a65536").End(xlUp).Row + 1


ws.Cells(nextrow, 1).Formula = "=today()"

ws.Cells(3, 8).Copy ws.Cells(nextrow, 2)
ws.Cells(nextrow, 2).Value = ws.Cells(nextrow, 2).Value

ws.Cells(3, 7).Copy ws.Cells(nextrow, 3)
ws.Cells(nextrow, 3).Value = ws.Cells(nextrow, 3).Value

ws.Cells(3, 6).Copy ws.Cells(nextrow, 4)
ws.Cells(nextrow, 4).Value = ws.Cells(nextrow, 4).Value

ActiveWorkbook.Save

FinalRow = ws.Range("a65536").End(xlUp).Row

With Worksheets("Weather")
With Range("a3:d" & FinalRow)
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="=RC3=Showers"
.FormatConditions(1).Interior.ColorIndex = 4
.FormatConditions.Add Type:=xlExpression, Formula1:="=RC3=Rain"
.FormatConditions(2).Interior.ColorIndex = 6
End With
End With


End Sub
Thanks!
 

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