floor and rounding

S

srroduin

I thought I had it after reading all of the other posts and links.

The user will put in a date and time in the input box. I need to round any
minutes down to the previous hour. Finally I need to add 1 hour to that
time. What am I doing wrong?

I went into tools references and added atpvbaen. Everytime I run it it says
function or sub not defined and floor is highlighted. Help!!!

So far I have this:

SASStart = InputBox("Enter start date mm/dd/yyyy hh:mm of event, USE CLOCK
TIME")

SASStartRound = Time(Hour(SASStart), Floor(Minute(SASStart), 1), 0)

SASStartClock = DateAdd("h", 1, SASStartRound)
 
P

peter

Hi,
try this...
sasstart = Now
sasstartround = Hour(sasstart) & ":" &
Application.WorksheetFunction.Floor(Minute(sasstart), 1)
SASStartClock = DateAdd("h", 1, sasstartround)
 
S

srroduin

I'm finally able to try this again now that I have the rest of my code working.

When I did this it didn't change anything. The SASStart value is typed in
by the user and is used throughout the code so I didn't make it = to now.

For example 5/10/2006 08:14 stayed the same. ANY IDEAS???? Thanks for you
help!
 
P

peter

Hi,
It's not the "now" that matters. Any time will do. Take a look at the
application.worksheetfunction in order to get floor to work.

peter
 

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