#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 70
Default A challenge in time

Hi Heres a challenge for some one what I would like to do is, in cell A2 I
would like to click on it with the mouse and a tick goes in the cell which
would also subtract C2 from B2, with the answer in D2 and I would like B2 to
be a drop down box with 00:00 to 24:00 as time. And the same in C2, so if B2
is 14:00 and C2 is 22:00 the answer would be 08:00 in cell D2.
Any Takers? thanks in advance.
Tommy.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,420
Default A challenge in time

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "A:A" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target

.Offset(0, 3).Value = .Offset(0, 2).Value - .Offset(0, 1).Value
.Value = "a"
.Font.Name = "Marlett"
.Offset(0, 1).Select
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--
__________________________________
HTH

Bob

"tommy" wrote in message
...
Hi Here's a challenge for some one what I would like to do is, in cell A2
I
would like to click on it with the mouse and a tick goes in the cell which
would also subtract C2 from B2, with the answer in D2 and I would like B2
to
be a drop down box with 00:00 to 24:00 as time. And the same in C2, so if
B2
is 14:00 and C2 is 22:00 the answer would be 08:00 in cell D2.
Any Takers? thanks in advance.
Tommy.



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 70
Default A challenge in time

Thanks Bob, Excuse my ignorance but what does it do.
Tommy


"Bob Phillips" wrote:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "A:A" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target

.Offset(0, 3).Value = .Offset(0, 2).Value - .Offset(0, 1).Value
.Value = "a"
.Font.Name = "Marlett"
.Offset(0, 1).Select
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--
__________________________________
HTH

Bob

"tommy" wrote in message
...
Hi Here's a challenge for some one what I would like to do is, in cell A2
I
would like to click on it with the mouse and a tick goes in the cell which
would also subtract C2 from B2, with the answer in D2 and I would like B2
to
be a drop down box with 00:00 to 24:00 as time. And the same in C2, so if
B2
is 14:00 and C2 is 22:00 the answer would be 08:00 in cell D2.
Any Takers? thanks in advance.
Tommy.




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,420
Default A challenge in time

Try it and see.

--
__________________________________
HTH

Bob

"tommy" wrote in message
...
Thanks Bob, Excuse my ignorance but what does it do.
Tommy


"Bob Phillips" wrote:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "A:A" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target

.Offset(0, 3).Value = .Offset(0, 2).Value - .Offset(0,
1).Value
.Value = "a"
.Font.Name = "Marlett"
.Offset(0, 1).Select
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--
__________________________________
HTH

Bob

"tommy" wrote in message
...
Hi Here's a challenge for some one what I would like to do is, in cell
A2
I
would like to click on it with the mouse and a tick goes in the cell
which
would also subtract C2 from B2, with the answer in D2 and I would like
B2
to
be a drop down box with 00:00 to 24:00 as time. And the same in C2, so
if
B2
is 14:00 and C2 is 22:00 the answer would be 08:00 in cell D2.
Any Takers? thanks in advance.
Tommy.






  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 70
Default A challenge in time

Fantastic !! thank you , at the risk of being rude where do I get the drop
down box, with the time in.
Tommy

"Bob Phillips" wrote:

Try it and see.

--
__________________________________
HTH

Bob

"tommy" wrote in message
...
Thanks Bob, Excuse my ignorance but what does it do.
Tommy


"Bob Phillips" wrote:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "A:A" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target

.Offset(0, 3).Value = .Offset(0, 2).Value - .Offset(0,
1).Value
.Value = "a"
.Font.Name = "Marlett"
.Offset(0, 1).Select
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--
__________________________________
HTH

Bob

"tommy" wrote in message
...
Hi Here's a challenge for some one what I would like to do is, in cell
A2
I
would like to click on it with the mouse and a tick goes in the cell
which
would also subtract C2 from B2, with the answer in D2 and I would like
B2
to
be a drop down box with 00:00 to 24:00 as time. And the same in C2, so
if
B2
is 14:00 and C2 is 22:00 the answer would be 08:00 in cell D2.
Any Takers? thanks in advance.
Tommy.









  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,420
Default A challenge in time

I presumed that you are had that.

Build a list of times and use DataValidationList and refer to that list.

--
__________________________________
HTH

Bob

"tommy" wrote in message
...
Fantastic !! thank you , at the risk of being rude where do I get the drop
down box, with the time in.
Tommy

"Bob Phillips" wrote:

Try it and see.

--
__________________________________
HTH

Bob

"tommy" wrote in message
...
Thanks Bob, Excuse my ignorance but what does it do.
Tommy


"Bob Phillips" wrote:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "A:A" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target

.Offset(0, 3).Value = .Offset(0, 2).Value - .Offset(0,
1).Value
.Value = "a"
.Font.Name = "Marlett"
.Offset(0, 1).Select
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--
__________________________________
HTH

Bob

"tommy" wrote in message
...
Hi Here's a challenge for some one what I would like to do is, in
cell
A2
I
would like to click on it with the mouse and a tick goes in the cell
which
would also subtract C2 from B2, with the answer in D2 and I would
like
B2
to
be a drop down box with 00:00 to 24:00 as time. And the same in C2,
so
if
B2
is 14:00 and C2 is 22:00 the answer would be 08:00 in cell D2.
Any Takers? thanks in advance.
Tommy.









  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 70
Default A challenge in time

Thanks Bob, It works great, Your a Gentleman and scholar.

"Bob Phillips" wrote:

I presumed that you are had that.

Build a list of times and use DataValidationList and refer to that list.

--
__________________________________
HTH

Bob

"tommy" wrote in message
...
Fantastic !! thank you , at the risk of being rude where do I get the drop
down box, with the time in.
Tommy

"Bob Phillips" wrote:

Try it and see.

--
__________________________________
HTH

Bob

"tommy" wrote in message
...
Thanks Bob, Excuse my ignorance but what does it do.
Tommy


"Bob Phillips" wrote:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "A:A" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target

.Offset(0, 3).Value = .Offset(0, 2).Value - .Offset(0,
1).Value
.Value = "a"
.Font.Name = "Marlett"
.Offset(0, 1).Select
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--
__________________________________
HTH

Bob

"tommy" wrote in message
...
Hi Here's a challenge for some one what I would like to do is, in
cell
A2
I
would like to click on it with the mouse and a tick goes in the cell
which
would also subtract C2 from B2, with the answer in D2 and I would
like
B2
to
be a drop down box with 00:00 to 24:00 as time. And the same in C2,
so
if
B2
is 14:00 and C2 is 22:00 the answer would be 08:00 in cell D2.
Any Takers? thanks in advance.
Tommy.










Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Here's a challenge... thorshammer Excel Worksheet Functions 4 August 12th 08 06:15 PM
Challenge OwenGiryluk Excel Worksheet Functions 10 October 1st 07 10:33 PM
A Challenge jimbob Excel Discussion (Misc queries) 17 April 1st 06 10:37 PM
A Challenge Jazzer Excel Worksheet Functions 3 July 8th 05 05:08 PM
Who is up for a challenge? Jambruins Excel Discussion (Misc queries) 2 April 12th 05 08:23 PM


All times are GMT +1. The time now is 11:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"