Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default VBA code for Timestamp

Gentlemen,
I am new to VBA, what I am trying to achieve is, for example when I enter a
text in cell A1 I want VBA script automatically put timestamp in a cell B1
and so on. There will be more text added later in column A, and I always want
the timestamp to appear right next to it, in column B.
I hope somebody will be able to help me, and also explain the steps how its
done.

Thank you,
Guntars

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default VBA code for Timestamp

Launch VBE using Alt+F11. From the left treeview double click Sheet1. From
drop down select Worksheet Change and paste the code so as look as below...

Try in Sheet1 ColA

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("$A:$A")) Is Nothing Then
Range("B" & Target.Row) = Now()
End If
End Sub
--
If this post helps click Yes
---------------
Jacob Skaria


"Guntars" wrote:

Gentlemen,
I am new to VBA, what I am trying to achieve is, for example when I enter a
text in cell A1 I want VBA script automatically put timestamp in a cell B1
and so on. There will be more text added later in column A, and I always want
the timestamp to appear right next to it, in column B.
I hope somebody will be able to help me, and also explain the steps how its
done.

Thank you,
Guntars

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default VBA code for Timestamp

Two follow up comments (for Gunter's consideration)...

1) You can also go directly to the code window for Sheet1 (or any sheet for
that matter) by right clicking the sheet's tab and selecting View Code from
the popup menu that appears.

2) There is no need for Gunter to click the drop downs and select Worksheet
and Change as your posted code already has the procedure framework that
doing so produces. All Gunter needs to do is popup the code window (using
either your posted method or #1 above) and copy/paste your posted code into
that code window.

--
Rick (MVP - Excel)


"Jacob Skaria" wrote in message
...
Launch VBE using Alt+F11. From the left treeview double click Sheet1. From
drop down select Worksheet Change and paste the code so as look as
below...

Try in Sheet1 ColA

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("$A:$A")) Is Nothing Then
Range("B" & Target.Row) = Now()
End If
End Sub
--
If this post helps click Yes
---------------
Jacob Skaria


"Guntars" wrote:

Gentlemen,
I am new to VBA, what I am trying to achieve is, for example when I enter
a
text in cell A1 I want VBA script automatically put timestamp in a cell
B1
and so on. There will be more text added later in column A, and I always
want
the timestamp to appear right next to it, in column B.
I hope somebody will be able to help me, and also explain the steps how
its
done.

Thank you,
Guntars


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default VBA code for Timestamp

I probably not doing something right.
As Rick Rothstein explained I right clicked on sheet tab - and selected
View Code - in VBA pasted the code and saved the script. When I tested in
excel nothing happens. I entered text in A1 but nothing shows up in B1. What
am I doing wrong, or is the timestamp hidden?


"Rick Rothstein" wrote:

Two follow up comments (for Gunter's consideration)...

1) You can also go directly to the code window for Sheet1 (or any sheet for
that matter) by right clicking the sheet's tab and selecting View Code from
the popup menu that appears.

2) There is no need for Gunter to click the drop downs and select Worksheet
and Change as your posted code already has the procedure framework that
doing so produces. All Gunter needs to do is popup the code window (using
either your posted method or #1 above) and copy/paste your posted code into
that code window.

--
Rick (MVP - Excel)


"Jacob Skaria" wrote in message
...
Launch VBE using Alt+F11. From the left treeview double click Sheet1. From
drop down select Worksheet Change and paste the code so as look as
below...

Try in Sheet1 ColA

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("$A:$A")) Is Nothing Then
Range("B" & Target.Row) = Now()
End If
End Sub
--
If this post helps click Yes
---------------
Jacob Skaria


"Guntars" wrote:

Gentlemen,
I am new to VBA, what I am trying to achieve is, for example when I enter
a
text in cell A1 I want VBA script automatically put timestamp in a cell
B1
and so on. There will be more text added later in column A, and I always
want
the timestamp to appear right next to it, in column B.
I hope somebody will be able to help me, and also explain the steps how
its
done.

Thank you,
Guntars



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default VBA code for Timestamp

Please set the security level to low/medium in (Tools|Macro|Security).

If this post helps click Yes
---------------
Jacob Skaria


"Guntars" wrote:

I probably not doing something right.
As Rick Rothstein explained I right clicked on sheet tab - and selected
View Code - in VBA pasted the code and saved the script. When I tested in
excel nothing happens. I entered text in A1 but nothing shows up in B1. What
am I doing wrong, or is the timestamp hidden?


"Rick Rothstein" wrote:

Two follow up comments (for Gunter's consideration)...

1) You can also go directly to the code window for Sheet1 (or any sheet for
that matter) by right clicking the sheet's tab and selecting View Code from
the popup menu that appears.

2) There is no need for Gunter to click the drop downs and select Worksheet
and Change as your posted code already has the procedure framework that
doing so produces. All Gunter needs to do is popup the code window (using
either your posted method or #1 above) and copy/paste your posted code into
that code window.

--
Rick (MVP - Excel)


"Jacob Skaria" wrote in message
...
Launch VBE using Alt+F11. From the left treeview double click Sheet1. From
drop down select Worksheet Change and paste the code so as look as
below...

Try in Sheet1 ColA

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("$A:$A")) Is Nothing Then
Range("B" & Target.Row) = Now()
End If
End Sub
--
If this post helps click Yes
---------------
Jacob Skaria


"Guntars" wrote:

Gentlemen,
I am new to VBA, what I am trying to achieve is, for example when I enter
a
text in cell A1 I want VBA script automatically put timestamp in a cell
B1
and so on. There will be more text added later in column A, and I always
want
the timestamp to appear right next to it, in column B.
I hope somebody will be able to help me, and also explain the steps how
its
done.

Thank you,
Guntars





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default VBA code for Timestamp

Thank you,
It is working great!
Guntars

"Jacob Skaria" wrote:

Please set the security level to low/medium in (Tools|Macro|Security).

If this post helps click Yes
---------------
Jacob Skaria


"Guntars" wrote:

I probably not doing something right.
As Rick Rothstein explained I right clicked on sheet tab - and selected
View Code - in VBA pasted the code and saved the script. When I tested in
excel nothing happens. I entered text in A1 but nothing shows up in B1. What
am I doing wrong, or is the timestamp hidden?


"Rick Rothstein" wrote:

Two follow up comments (for Gunter's consideration)...

1) You can also go directly to the code window for Sheet1 (or any sheet for
that matter) by right clicking the sheet's tab and selecting View Code from
the popup menu that appears.

2) There is no need for Gunter to click the drop downs and select Worksheet
and Change as your posted code already has the procedure framework that
doing so produces. All Gunter needs to do is popup the code window (using
either your posted method or #1 above) and copy/paste your posted code into
that code window.

--
Rick (MVP - Excel)


"Jacob Skaria" wrote in message
...
Launch VBE using Alt+F11. From the left treeview double click Sheet1. From
drop down select Worksheet Change and paste the code so as look as
below...

Try in Sheet1 ColA

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("$A:$A")) Is Nothing Then
Range("B" & Target.Row) = Now()
End If
End Sub
--
If this post helps click Yes
---------------
Jacob Skaria


"Guntars" wrote:

Gentlemen,
I am new to VBA, what I am trying to achieve is, for example when I enter
a
text in cell A1 I want VBA script automatically put timestamp in a cell
B1
and so on. There will be more text added later in column A, and I always
want
the timestamp to appear right next to it, in column B.
I hope somebody will be able to help me, and also explain the steps how
its
done.

Thank you,
Guntars



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
userform code for timestamp on w/sheet TUNGANA KURMA RAJU Excel Programming 2 April 2nd 09 03:15 AM
Timestamp PS Excel Discussion (Misc queries) 2 January 10th 07 02:21 PM
Timestamp Sher Excel Discussion (Misc queries) 2 November 3rd 06 04:31 PM
timestamp on each row... Starrpro50 Excel Programming 3 October 27th 04 08:37 PM
timestamp tommyboy[_3_] Excel Programming 6 July 7th 04 10:19 AM


All times are GMT +1. The time now is 11:17 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"