I got this script from this site for colouring cells and it works a treat
It is placed in the worksheet code. However in a module I also have this script for inserting a new line at the top of my range and then formattiiong it for the data, finally opening up a user form.
I have found that the second script hangs when it gets to the line " ActiveSheet.Paste" with the error message "Paste method of Worksheet class failed"
each script works when the other is removed.
What do I need to do so as to get them both to work?
Code:
Public OldRng As Range
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not OldRng Is Nothing Then
OldRng.Interior.ColorIndex = xlNone
End If
Target.Interior.ColorIndex = 6
Set OldRng = Target
End Sub
It is placed in the worksheet code. However in a module I also have this script for inserting a new line at the top of my range and then formattiiong it for the data, finally opening up a user form.
Code:
Sub StartNewJob_Click()
Rows("4:4").Select
Selection.Insert Shift:=xlDown
Range("A5:M5").Select
Selection.Copy
Range("A4").Select
ActiveSheet.Paste
Range("A4:H4").Select
Selection.ClearContents
Range("J4").Select
Selection.ClearContents
Range("L4").Select
Selection.ClearContents
Range("A4").Select
MainRecForm.Show
End Sub
I have found that the second script hangs when it gets to the line " ActiveSheet.Paste" with the error message "Paste method of Worksheet class failed"
each script works when the other is removed.
What do I need to do so as to get them both to work?