Hide Rows based on Time Selection in timesheet.
Tom, I also get a
Run-time Error 1004
Method 'Range' of object'_Worksheet' failed
on line:
set rng = Range(B15,cells(rows.count,1).End(xlup))
thanks...
I was also trying to run as a Macro..
"Tom Ogilvy" wrote:
You use a new sheet for each day?
Assume time column is column A and times start in cell A2
Dim rng as Range, res as Variant, res1 as Variant
set rng = Range(A2,cells(rows.count,1).End(xlup))
Set StartTime = Range("F9")
set EndTime = Range("F10")
res = Application.Match(StartTime,rng,0)
res1 = application.Match(EndTime,rng,0)
if not iserror(res) then
rows(2).Resize(res).Entirerow.Hidden = True
end if
if not iserror(res1) then
range(rng(res1).offset(1,0),rng(rng.count)).Entire Row.Hidden = True
End if
--
Regards,
Tom Ogilvy
"thom hoyle" wrote in message
...
thanks for looking @ this.
Is it possible too.
I have a timesheet that users use everyday. It has a column that starts @
5:00am and goes to 12:00 Midnight. Each Row respresents a Tenth of an
hour.
In two other cells I have a "Arrival TIME" and " Departure TIME" ..
Normally
they start @ 8:00am, leave @ 5:00pm .. Both these are DataValidation List
using the same 5:00am to 12:00am list.
Is it possible too, based on the users selection of ARRIVAL time, to HIDE
ROWS in the TIME COLUMN that are less than the ARRIVAL Time? .. if the
user
comes in @ 8:00 am, it would hide rows from 5:00am to 7:50am .. I would
like
to do the same with Departure Time.. If the user leaves @ 5:00pm .. it
would
hide from 5:10pm to 12:00 midnight.. Basically to "shorten" the timesheet
up
to the hours they are working.
I hope I have explained this correclty. Thanks for you help.
thom
|