I have a problem. I have created macro which copies text from one cell and paste it to other cell in other sheet.This macro is called from other macro so that if you change any cell in specific range then it will call this macro.
Now it works every second time but when does not run time error 1004 occurs. it seems that error occurs during activesheet.paste command. What should i do?
Here's the mmacro which calls other macro when specific cells are changed :
Expand|Select|Wrap|Line Numbers
- Private Sub Worksheet_Change(ByVal Target As Range)
- Dim KeyCells As Range
- Set KeyCells = Range("AnalysoitavatS[Note]")
- If Not Application.Intersect(KeyCells, Range(Target.Address)) _
- Is Nothing Then
- Call kopioi_note
- End If
- End Sub
Expand|Select|Wrap|Line Numbers
- ActiveCell.Offset(-1, 0).Copy
- ActiveCell.Offset(-1, -9).Select
- Value2 = Selection
- Sheets("KAIKKI HUOLLOT").Select
- ActiveSheet.Unprotect Password:="1"
- Range("MASTER[Order]").Select
- Selection.Find(What:=Value2, After:=ActiveCell, LookIn:=xlFormulas, _
- Lookat:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
- MatchCase:=False, SearchFormat:=False).Activate
- ActiveCell.Offset(0, 21).Activate
- ActiveSheet.Paste
- ActiveSheet.Protect Password:="1"
- Sheets("ANALYSOINTI").Select
- Range("A3").Select