LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 39
Default Alternative copy/delete method needed

Hi,
I am currently using the code below to copy a row of datat to the next sheet
and then delete the old data. This works perfectly until the workbook is
shared after which the delete part fails to work (but doesn't return an
error).
I have posted questions regarding this but the best brains have been unable
to replicate the error so have been unable to help.
I am therefore asking if anyone can rewrite this code using a different
method which I can then try to see if it will work.

Current code is:

Private Sub Worksheet_Change(ByVal Target As Range)

Const WS_RANGE As String = "J:J" 'This is the colum that runs the macro
Dim rng1 As Range
Dim rng2 As Range

If Target.Cells.Count 1 Then
Exit Sub 'single cell at a time
End If

If Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
Exit Sub
End If

Set rng1 = Target.EntireRow.Range("A1:J1") 'The range A1:J1 ensures the
copied data doesn't overwrite formatting on next sheet in columns K:L:M

With Worksheets("outcomes")
Set rng2 = .Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0)
End With

On Error GoTo ws_exit:
Application.EnableEvents = False
If Target.Value < "" Then
With rng1
..Copy _
Destination:=rng2
..Delete Shift:=xlUp
End With
End If
ws_exit:
Application.EnableEvents = True

End Sub

Any help would be most welcome :-)
 
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-Paste Alternative Needed... Turp Excel Discussion (Misc queries) 1 January 12th 10 07:03 PM
How to delete or copy alternative rows/columns at a time? Bhagavan Excel Discussion (Misc queries) 0 May 12th 08 07:31 PM
expert help needed for better alternative to slow workbook timteebow66 Excel Worksheet Functions 3 March 25th 08 07:03 AM
ALTERNATIVE TO SUMPRODUCT NEEDED Rog Excel Worksheet Functions 26 August 2nd 07 08:50 PM
Vlookup Alternative Needed Rita Palazzi Excel Discussion (Misc queries) 3 March 2nd 06 04:14 PM


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

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"