Macro Code required

M

muddan madhu

Hi,

I have a macro to calculate the time ...
Col A - Start time
Col B - End Time

click Button created -e.g., if user click that buttton it gives the
system time as 00:06:53 in A1 (hh:mm:ss) and again
if user click that button it will gives the system 00:06:55 in
B1.... if user click that button again it moves to A2 and gives the
times...
similarly it moves down as and when user clicks..

The problem is user chooses different cells, so this lead wrong time
calculation so i need to specify the range as (B10:C100). so that the
time will
calculate in right manner.

Thanks a lot
 
E

Earl Kiosterud

Muddan,

Dim Coll As Integer
Dim Roww As Integer

Sub TimeReset()
Coll = 1
Roww = 1
End Sub

Sub TimeInsert()
If Roww = 0 Or Coll = 0 Then TimeReset
Cells(Coll, Roww) = Time()
If Roww = 1 Then
Roww = Roww + 1
Else
Roww = 1
Coll = Coll + 1
End If
End Sub
 

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

Similar Threads

macro code required 2
Macro code to set range 3
Macro 1
"Out of Stack Space" Macro Error 3
Array formula ? 2
Please Help Calculate Time Between 2 different Dates 6
Can anyone ! 1
Macro Relative Cells 3

Top