LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default OnTime Change_Event macro AND copy to sheet2 macro trouble

The change event macro is in sheet 1 module.
The TheNameOfMySub macro is in Module 1.

(I had the TheNameOfMySub macro just below the change event in sheet 1 module but it produced an error as if the macro it was calling was not available in this workbook...)

The results are so varied I am at a loss to try to explain them all.
I would appreciate it if you would duplicate a sheet1 and sheet2 with the codes and tell me what I'm doing wrong.

The results I expect a

If A1:A15 of sheet 1 is changed, then after the time lapses in the change event macro, each cell in A1:A15 will be copied to the first empty cell on sheet 2 of each row.

Seems like first copy works ok, but make a change in A1:A15 and next time there is no copy. The sheet "blinks" like the macro was fired but no results.

If I go to Module 1 and click on the "Run Macro" icon it copies just fine.
There might be some other ghost like stuff that happens sometimes but I've lost track of what they might have been.

Thanks,
Howard


Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Application.OnTime Now + TimeValue("00:00:10"), "TheNameOfMySub"
End Sub

Sub TheNameOfMySub()

Dim c As Range
Application.ScreenUpdating = False
If Not Range("A1:A15") Is Nothing Then
For Each c In Range("A1:A15")
c.Copy
If Sheets("Sheet1").Range("A" & c.Row).Value = "" Then
Sheets("Sheet1").Range("A" & c.Row).PasteSpecial
Else
Sheets("Sheet2").Cells(c.Row, Sheets("Sheet2").Cells(c.Row, Columns.Count). _
End(xlToLeft).Column + 1).PasteSpecial
End If
Next
Else
Exit Sub
End If
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
 
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
copy data from sheet2 to sheet1 when sheet2 has variable # of rows Anne Excel Discussion (Misc queries) 6 February 27th 09 09:48 PM
macro to print sheet2 without open sheet2 ramzi Excel Discussion (Misc queries) 1 January 28th 09 12:07 PM
Macro to Copy data from a list in sheet1 and paste into sheet2 Michael Excel Discussion (Misc queries) 3 April 23rd 08 06:52 PM
Trouble formatting Row Height while using a Copy/Paste Macro MK@Hartford Excel Programming 1 December 4th 05 04:44 PM
Macro to copy contents in current row to Sheet2 theDude[_2_] Excel Programming 1 May 31st 05 06:27 PM


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