R
RompStar
ok, I have a script that compares two dates:
A scheduled pickup date - column J
and
The Acctual Picked up date - column K
in order to be compliant, the time frame between these two dates
can't not take longer then 2 days from the scheduled pickup date.
Right now, the script when I run it, looks at all the data and in
column N
prefilles the =NETWORKDAYS formula and then runs the statistics,
showing
anything less then 0 as red and more then 2 as red, 0, 1, 2 as black.
Then on the spreadsheet I have a formula that looks at the column N
and counts the number ranges and figure out the percentage.
So basically, J and K have the dates, and N prints the end results
based on the date data, there are other columns, but they are
irrelavant to this script.
What I want to change, is when I press the play script button, it pops
up 2 screens at the user. In the first one it would ask the the date
range from the column J (scheduled pickup date), user enters that,
presses enter, and then another box pops up asking for the Pickup Date
Range from the K column.
And then it would run the number comparisons only on those date ranges,
so for example, if I type:
4/1/2005 for J, and 4/6/2005 for K, and press enter, it runs the rest
of the script and enters the numbers in the Columns N for rows that
match that selected date range: Here is my script so far...
start ---
Sub SelectiveFormatandfillformula()
Dim c As Range
Dim LastRow As Long
LastRow = Range("N11").End(xlDown).Row
On Error GoTo Finish
Range("N11:N" & Range("a65536").End(xlUp).Row).Formula = _
"=NETWORKDAYS(J11,K11)-1"
Set c = Range("N11:N" & LastRow)
For Each Item In c
If Val(Item) > 2 Or Val(Item) < 0 Then
Item.Font.Bold = True
Item.Font.COLOR = vbRed
Else
Item.Font.Bold = True
Item.Font.COLOR = vbBlack
End If
Next Item
Finish:
End Sub
end ---
Help me out guys, still a newbie :- )
I guess I will need two new variable, c1 and c2, for the two pop-up
windows, unless I can do it all in one pop-up window :- )
set c1 = Application.InputBox("Enter for J", how to store the value ?
set c2 = Application.InputBox("Enter for J", how to store the value ?
thanks.
A scheduled pickup date - column J
and
The Acctual Picked up date - column K
in order to be compliant, the time frame between these two dates
can't not take longer then 2 days from the scheduled pickup date.
Right now, the script when I run it, looks at all the data and in
column N
prefilles the =NETWORKDAYS formula and then runs the statistics,
showing
anything less then 0 as red and more then 2 as red, 0, 1, 2 as black.
Then on the spreadsheet I have a formula that looks at the column N
and counts the number ranges and figure out the percentage.
So basically, J and K have the dates, and N prints the end results
based on the date data, there are other columns, but they are
irrelavant to this script.
What I want to change, is when I press the play script button, it pops
up 2 screens at the user. In the first one it would ask the the date
range from the column J (scheduled pickup date), user enters that,
presses enter, and then another box pops up asking for the Pickup Date
Range from the K column.
And then it would run the number comparisons only on those date ranges,
so for example, if I type:
4/1/2005 for J, and 4/6/2005 for K, and press enter, it runs the rest
of the script and enters the numbers in the Columns N for rows that
match that selected date range: Here is my script so far...
start ---
Sub SelectiveFormatandfillformula()
Dim c As Range
Dim LastRow As Long
LastRow = Range("N11").End(xlDown).Row
On Error GoTo Finish
Range("N11:N" & Range("a65536").End(xlUp).Row).Formula = _
"=NETWORKDAYS(J11,K11)-1"
Set c = Range("N11:N" & LastRow)
For Each Item In c
If Val(Item) > 2 Or Val(Item) < 0 Then
Item.Font.Bold = True
Item.Font.COLOR = vbRed
Else
Item.Font.Bold = True
Item.Font.COLOR = vbBlack
End If
Next Item
Finish:
End Sub
end ---
Help me out guys, still a newbie :- )
I guess I will need two new variable, c1 and c2, for the two pop-up
windows, unless I can do it all in one pop-up window :- )
set c1 = Application.InputBox("Enter for J", how to store the value ?
set c2 = Application.InputBox("Enter for J", how to store the value ?
thanks.