VBA excel

Joined
Sep 6, 2011
Messages
5
Reaction score
0
Hey guys,

I wrote this code that works to calculate the average total hours using the dates which obviously works however, I just wanted to be able to change the range "E3" and E34" so that if I apply to another file WITHOUT knowing the range I could still get the answer and the code will work, without changing the range in the module. Could anybody help me with that. I want the answer to go in the cell "B15"


Sub CalculateHours2()

Range("B15").Value = DateDiff("h", Range("E3").Value, Range("E34").Value)

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