Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
TGV TGV is offline
external usenet poster
 
Posts: 63
Default VB Code Required for Capturing Time

If i enter anything in B column cell then the vb code should caputure the
current system timing in C column cell. For example if i am entering a text
in B1 cell then the vb code should capture the current time in C1 cell. Like
this it should capture the time in C column for B Column entry, and this VB
Code should work for all the sheets in that workbook.

Thanks in Advance.

TGV
  #2   Report Post  
Posted to microsoft.public.excel.misc
TGV TGV is offline
external usenet poster
 
Posts: 63
Default VB Code Required for Capturing Time

Hi,

I forgot to say one thing that is i want to protect the C column and rest of
the columns except B column whether the macro will work on protected columns?

People can able to access only the B Column so i dont know whether the macro
will generate the result in the protected cells. whether it is possible?

Thank you

TGV

"TGV" wrote:

If i enter anything in B column cell then the vb code should caputure the
current system timing in C column cell. For example if i am entering a text
in B1 cell then the vb code should capture the current time in C1 cell. Like
this it should capture the time in C column for B Column entry, and this VB
Code should work for all the sheets in that workbook.

Thanks in Advance.

TGV

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default VB Code Required for Capturing Time

Hi,

Alt+F11 to open VB editor. Doubleclick 'ThisWorkbook' and paste the code in
on the right. Note if you want the dat and the time change TIME to NOW

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Not Intersect(Target, Range("B:B")) Is Nothing Then
Application.EnableEvents = False
Target.Offset(, 1).Value = Time
Application.EnableEvents = True
End If
End Sub

Mike

"TGV" wrote:

If i enter anything in B column cell then the vb code should caputure the
current system timing in C column cell. For example if i am entering a text
in B1 cell then the vb code should capture the current time in C1 cell. Like
this it should capture the time in C column for B Column entry, and this VB
Code should work for all the sheets in that workbook.

Thanks in Advance.

TGV

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default VB Code Required for Capturing Time

Hi,

Thats is an important detail you left out. For this to work column B cells
must be unlocked or data can't be entered in those cells and I assume you
know how to do that with

Format|Cells - protection tab and remove the 'Locked' checkmark for column B
cells.

To enter anything into column C it must be fleetingly unprotected and this
revised macro will do that. Change MyPass to your password.

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Not Intersect(Target, Range("B:B")) Is Nothing Then
Application.EnableEvents = False
ActiveSheet.Unprotect Password:="MyPass"
Target.Offset(, 1).Value = Time
ActiveSheet.Protect Password:="MyPass"
Application.EnableEvents = True
End If
End Sub

Mike

"TGV" wrote:

Hi,

I forgot to say one thing that is i want to protect the C column and rest of
the columns except B column whether the macro will work on protected columns?

People can able to access only the B Column so i dont know whether the macro
will generate the result in the protected cells. whether it is possible?

Thank you

TGV

"TGV" wrote:

If i enter anything in B column cell then the vb code should caputure the
current system timing in C column cell. For example if i am entering a text
in B1 cell then the vb code should capture the current time in C1 cell. Like
this it should capture the time in C column for B Column entry, and this VB
Code should work for all the sheets in that workbook.

Thanks in Advance.

TGV

  #5   Report Post  
Posted to microsoft.public.excel.misc
TGV TGV is offline
external usenet poster
 
Posts: 63
Default VB Code Required for Capturing Time

Thank you Boss it's very Nice........

TGV

"Mike H" wrote:

Hi,

Thats is an important detail you left out. For this to work column B cells
must be unlocked or data can't be entered in those cells and I assume you
know how to do that with

Format|Cells - protection tab and remove the 'Locked' checkmark for column B
cells.

To enter anything into column C it must be fleetingly unprotected and this
revised macro will do that. Change MyPass to your password.

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Not Intersect(Target, Range("B:B")) Is Nothing Then
Application.EnableEvents = False
ActiveSheet.Unprotect Password:="MyPass"
Target.Offset(, 1).Value = Time
ActiveSheet.Protect Password:="MyPass"
Application.EnableEvents = True
End If
End Sub

Mike

"TGV" wrote:

Hi,

I forgot to say one thing that is i want to protect the C column and rest of
the columns except B column whether the macro will work on protected columns?

People can able to access only the B Column so i dont know whether the macro
will generate the result in the protected cells. whether it is possible?

Thank you

TGV

"TGV" wrote:

If i enter anything in B column cell then the vb code should caputure the
current system timing in C column cell. For example if i am entering a text
in B1 cell then the vb code should capture the current time in C1 cell. Like
this it should capture the time in C column for B Column entry, and this VB
Code should work for all the sheets in that workbook.

Thanks in Advance.

TGV

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
Changes Required In Macro Code TGV Excel Discussion (Misc queries) 2 February 10th 09 05:53 PM
Another VB Code Required TGV Excel Discussion (Misc queries) 7 February 7th 09 07:21 AM
VB Code Required TGV Excel Discussion (Misc queries) 3 February 6th 09 05:31 PM
Capturing average turn around time with constraints BrettS Excel Worksheet Functions 0 June 17th 08 03:12 PM
Date Capturing by Time Ken Excel Discussion (Misc queries) 1 December 2nd 07 10:50 AM


All times are GMT +1. The time now is 01:02 PM.

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

About Us

"It's about Microsoft Excel"