Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Pank Mehta
 
Posts: n/a
Default Automatically move down to the next row

I have a macro that automatically inserts the time and date in certain
columns.

Is there a way as part of the macro once the date and time have been
populated, I can get to the start of the next row?

Any help appreciated.

  #2   Report Post  
Mangesh
 
Posts: n/a
Default

You know the row in which you are adding the time/date. Just add 1 to it and
select the first column.
if you show your macro, it would be easier to help.

- Mangesh


"Pank Mehta" wrote in message
...
I have a macro that automatically inserts the time and date in certain
columns.

Is there a way as part of the macro once the date and time have been
populated, I can get to the start of the next row?

Any help appreciated.



  #3   Report Post  
Pank Mehta
 
Posts: n/a
Default

The macro is as follows:-

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False
On Error GoTo ws_exit
With Target
If .Column = 8 Then
Me.Unprotect
With .Offset(0, 1)
.Value = Date
.NumberFormat = "dd mmm yy"
End With
With .Offset(0, 2)
.Value = Now
.NumberFormat = "hh:mm"
End With
End If
End With

ws_exit:
Application.EnableEvents = True
Me.Protect

End Sub

"Mangesh" wrote:

You know the row in which you are adding the time/date. Just add 1 to it and
select the first column.
if you show your macro, it would be easier to help.

- Mangesh


"Pank Mehta" wrote in message
...
I have a macro that automatically inserts the time and date in certain
columns.

Is there a way as part of the macro once the date and time have been
populated, I can get to the start of the next row?

Any help appreciated.




  #4   Report Post  
Bob Phillips
 
Posts: n/a
Default

Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False
On Error GoTo ws_exit
With Target
If .Column = 8 Then
Me.Unprotect
With .Offset(0, 1)
.Value = Date
.NumberFormat = "dd mmm yy"
End With
With .Offset(0, 2)
.Value = Now
.NumberFormat = "hh:mm"
End With
Cells(.Row+1,1).Activate
End If
End With

ws_exit:
Application.EnableEvents = True
Me.Protect

End Sub


--
HTH

Bob Phillips

"Pank Mehta" wrote in message
...
The macro is as follows:-

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False
On Error GoTo ws_exit
With Target
If .Column = 8 Then
Me.Unprotect
With .Offset(0, 1)
.Value = Date
.NumberFormat = "dd mmm yy"
End With
With .Offset(0, 2)
.Value = Now
.NumberFormat = "hh:mm"
End With
End If
End With

ws_exit:
Application.EnableEvents = True
Me.Protect

End Sub

"Mangesh" wrote:

You know the row in which you are adding the time/date. Just add 1 to it

and
select the first column.
if you show your macro, it would be easier to help.

- Mangesh


"Pank Mehta" wrote in message
...
I have a macro that automatically inserts the time and date in certain
columns.

Is there a way as part of the macro once the date and time have been
populated, I can get to the start of the next row?

Any help appreciated.






  #5   Report Post  
Mangesh
 
Posts: n/a
Default

Add the line:
Cells(Target.Row + 1, 1).Select



Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False
On Error GoTo ws_exit
With Target
If .Column = 8 Then
Me.Unprotect
With .Offset(0, 1)
.Value = Date
.NumberFormat = "dd mmm yy"
End With
With .Offset(0, 2)
.Value = Now
.NumberFormat = "hh:mm"
End With
Cells(Target.Row + 1, 1).Select ' new line added
End If
End With

ws_exit:
Application.EnableEvents = True
Me.Protect

End Sub


- Mangesh



"Pank Mehta" wrote in message
...
The macro is as follows:-

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False
On Error GoTo ws_exit
With Target
If .Column = 8 Then
Me.Unprotect
With .Offset(0, 1)
.Value = Date
.NumberFormat = "dd mmm yy"
End With
With .Offset(0, 2)
.Value = Now
.NumberFormat = "hh:mm"
End With
End If
End With

ws_exit:
Application.EnableEvents = True
Me.Protect

End Sub

"Mangesh" wrote:

You know the row in which you are adding the time/date. Just add 1 to it

and
select the first column.
if you show your macro, it would be easier to help.

- Mangesh


"Pank Mehta" wrote in message
...
I have a macro that automatically inserts the time and date in certain
columns.

Is there a way as part of the macro once the date and time have been
populated, I can get to the start of the next row?

Any help appreciated.








  #6   Report Post  
Pank Mehta
 
Posts: n/a
Default

Mangesh, Bob,

Many thanks for the prompt response and the solution.

"Mangesh" wrote:

Add the line:
Cells(Target.Row + 1, 1).Select



Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False
On Error GoTo ws_exit
With Target
If .Column = 8 Then
Me.Unprotect
With .Offset(0, 1)
.Value = Date
.NumberFormat = "dd mmm yy"
End With
With .Offset(0, 2)
.Value = Now
.NumberFormat = "hh:mm"
End With
Cells(Target.Row + 1, 1).Select ' new line added
End If
End With

ws_exit:
Application.EnableEvents = True
Me.Protect

End Sub


- Mangesh



"Pank Mehta" wrote in message
...
The macro is as follows:-

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False
On Error GoTo ws_exit
With Target
If .Column = 8 Then
Me.Unprotect
With .Offset(0, 1)
.Value = Date
.NumberFormat = "dd mmm yy"
End With
With .Offset(0, 2)
.Value = Now
.NumberFormat = "hh:mm"
End With
End If
End With

ws_exit:
Application.EnableEvents = True
Me.Protect

End Sub

"Mangesh" wrote:

You know the row in which you are adding the time/date. Just add 1 to it

and
select the first column.
if you show your macro, it would be easier to help.

- Mangesh


"Pank Mehta" wrote in message
...
I have a macro that automatically inserts the time and date in certain
columns.

Is there a way as part of the macro once the date and time have been
populated, I can get to the start of the next row?

Any help appreciated.







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
Moving rows with Hyperlink doesn't move hyperlink address Samad Excel Discussion (Misc queries) 15 June 22nd 06 12:03 PM
Formula referencing deleted row (move up automatically) Paulymon Excel Worksheet Functions 1 March 17th 05 08:41 PM
Timeline: where it will match up data automatically Fidelio1st Excel Discussion (Misc queries) 0 March 5th 05 06:27 PM
command button in excel will move when print. [email protected] Excel Discussion (Misc queries) 1 December 29th 04 03:53 PM
After scanning a barcode how can I automatically move to the next. tbledsoe Excel Discussion (Misc queries) 1 December 4th 04 08:18 PM


All times are GMT +1. The time now is 05:27 AM.

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"