PC Review


Reply
Thread Tools Rate Thread

Automatically Copy Information when data is entered

 
 
JOSEPH WEBER
Guest
Posts: n/a
 
      25th May 2010
I have the following code in events of one tab of a spreadsheet. It copies
from the line above. I need it to copy a formula in the cells L1:V1. Please
show me where I should change the code to make it accomplish this task.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col J
On Error GoTo enditall
Application.EnableEvents = True
If Target.Cells.Column = 10 Then
N = Target.Row
If Me.Range("j" & N).Value <> "" Then
With Me.Range("L" & N)
.Value = Format(Now, "mm-dd-yyyy hh:mm:ss")
.Offset(-1, 1).Resize(1, 10).Copy Destination:=.Offset(0, 1)



End With
End If
End If
enditall:
Application.EnableEvents = True
End Sub


 
Reply With Quote
 
 
 
 
Gord Dibben
Guest
Posts: n/a
 
      25th May 2010
Do you mean copy formulas "from" L1:V1 to active row?

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col J
Dim rng As Range
Set rng = Me.Range("L1:V1")
On Error GoTo enditall
Application.EnableEvents = True
If Target.Cells.Column = 10 Then
N = Target.Row
If Me.Range("j" & N).Value <> "" Then
rng.Copy Destination:=Me.Range("L" & N)
End If
End If
enditall:
Application.EnableEvents = True
End Sub


Gord Dibben MS Excel MVP

On Tue, 25 May 2010 07:31:01 -0700, JOSEPH WEBER
<(E-Mail Removed)> wrote:

>I have the following code in events of one tab of a spreadsheet. It copies
>from the line above. I need it to copy a formula in the cells L1:V1. Please
>show me where I should change the code to make it accomplish this task.
>
>Private Sub Worksheet_Change(ByVal Target As Excel.Range)
>'when entering data in a cell in Col J
>On Error GoTo enditall
> Application.EnableEvents = True
>If Target.Cells.Column = 10 Then
> N = Target.Row
> If Me.Range("j" & N).Value <> "" Then
> With Me.Range("L" & N)
> .Value = Format(Now, "mm-dd-yyyy hh:mm:ss")
> .Offset(-1, 1).Resize(1, 10).Copy Destination:=.Offset(0, 1)
>
>
>
> End With
> End If
> End If
>enditall:
> Application.EnableEvents = True
>End Sub
>


 
Reply With Quote
 
JOSEPH WEBER
Guest
Posts: n/a
 
      25th May 2010
Thanks so much. that makes life ten times easier. Works perfectly

"JOSEPH WEBER" wrote:

> I have the following code in events of one tab of a spreadsheet. It copies
> from the line above. I need it to copy a formula in the cells L1:V1. Please
> show me where I should change the code to make it accomplish this task.
>
> Private Sub Worksheet_Change(ByVal Target As Excel.Range)
> 'when entering data in a cell in Col J
> On Error GoTo enditall
> Application.EnableEvents = True
> If Target.Cells.Column = 10 Then
> N = Target.Row
> If Me.Range("j" & N).Value <> "" Then
> With Me.Range("L" & N)
> .Value = Format(Now, "mm-dd-yyyy hh:mm:ss")
> .Offset(-1, 1).Resize(1, 10).Copy Destination:=.Offset(0, 1)
>
>
>
> End With
> End If
> End If
> enditall:
> Application.EnableEvents = True
> End Sub
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Range updating automatically as new data is entered mgnrke28 Microsoft Excel Charting 1 10th Jul 2008 02:02 PM
Data Base, copy information one sheet to another automatically =?Utf-8?B?QmlsbCBCdWxh?= Microsoft Excel Misc 2 5th Nov 2007 01:04 PM
How do I get data automatically entered into a cell? =?Utf-8?B?cmxkamRh?= Microsoft Excel Worksheet Functions 1 18th Jan 2007 07:19 AM
Copy formula automatically down when date is entered tommylux Microsoft Excel Misc 15 11th Oct 2006 04:51 PM
How can I generate pages automatically from information entered i. =?Utf-8?B?TWlyY28=?= Microsoft Word Document Management 1 19th Nov 2004 03:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:07 AM.