Can someone please tell me why my code stopped working???

D

Damil4real

Option Explicit

The code below worked for a few days and just totally stopped working.
What can I do to make sure it continues to work? Thanks!

-----



Private Sub Worksheet_Change(ByVal Target As Range)
Dim C As Range, D As Range
Set D = Intersect(Range("A:A"), Target)
If D Is Nothing Then Exit Sub
For Each C In D


On Error Resume Next
Target.Offset(0, 6).FormulaR1C1 = "=RC[-2]&RC[-5]" ' - For Column E
Target.Offset(0, 7).FormulaR1C1 = "=RC[-2]&RC[-5]" ' - For Column F
Target.Offset(0, 9).FormulaR1C1 = "=IF(ISNA(VLOOKUP(RC7,I.O.!
R2C1:R5708C5,4,FALSE))=TRUE,0,VLOOKUP(RC7,I.O.!R2C1:R5708C5,4,FALSE))"
' - For Column J
Target.Offset(0, 10).FormulaR1C1 = "=IF(ISNA(VLOOKUP(RC8,'Mellon
Download'!R2C1:R4573C3,2,FALSE))=TRUE,0,VLOOKUP(RC8,'Mellon Download'!
R2C1:R4573C3,2,FALSE))" ' - For Column K
Target.Offset(0, 11).FormulaR1C1 = "=RC[-2]-RC[-1]" ' - For Column L
Target.Offset(0, 12).FormulaR1C1 = "=IF(ISNA(VLOOKUP(RC7,I.O.!
R2C1:R5392C5,5,FALSE))=TRUE,0,VLOOKUP(RC7,I.O.!R2C1:R5392C5,5,FALSE))-
IF(ISNA(VLOOKUP(RC8,'Mellon Download'!R2C1:R4573C3,3,FALSE))=TRUE,
0,VLOOKUP(RC8,'Mellon Download'!R2C1:R4573C3,3,FALSE))" ' - For Column
M
Target.Offset(0, 13).Value = "1" ' - For Column N
Target.Offset(0, 14).FormulaR1C1 = "=RC[-2]*RC[-1]" ' - For Column O
Target.Offset(0, 15).FormulaR1C1 = "=TODAY()" ' - For Column p
Target.Offset(0, 16).FormulaR1C1 = "=IF(RC[-1]="""","""",TODAY()-RC
[-1])" ' - For Column Q

Next C

End Sub
 
T

teylyn

I'm sure if you posted this in the programming newsgroup, you'd get a
answer

Damil4real;568449 said:
Option Explicit

The code below worked for a few days and just totally stopped working.
What can I do to make sure it continues to work? Thanks!

-----



Private Sub Worksheet_Change(ByVal Target As Range)
Dim C As Range, D As Range
Set D = Intersect(Range("A:A"), Target)
If D Is Nothing Then Exit Sub
For Each C In D


On Error Resume Next
Target.Offset(0, 6).FormulaR1C1 = "=RC[-2]&RC[-5]" ' - For Column E
Target.Offset(0, 7).FormulaR1C1 = "=RC[-2]&RC[-5]" ' - For Column F
Target.Offset(0, 9).FormulaR1C1 = "=IF(ISNA(VLOOKUP(RC7,I.O.!
R2C1:R5708C5,4,FALSE))=TRUE,0,VLOOKUP(RC7,I.O.!R2C1:R5708C5,4,FALSE))"
' - For Column J
Target.Offset(0, 10).FormulaR1C1 = "=IF(ISNA(VLOOKUP(RC8,'Mellon
Download'!R2C1:R4573C3,2,FALSE))=TRUE,0,VLOOKUP(RC8,'Mellon Download'!
R2C1:R4573C3,2,FALSE))" ' - For Column K
Target.Offset(0, 11).FormulaR1C1 = "=RC[-2]-RC[-1]" ' - For Column L
Target.Offset(0, 12).FormulaR1C1 = "=IF(ISNA(VLOOKUP(RC7,I.O.!
R2C1:R5392C5,5,FALSE))=TRUE,0,VLOOKUP(RC7,I.O.!R2C1:R5392C5,5,FALSE))-
IF(ISNA(VLOOKUP(RC8,'Mellon Download'!R2C1:R4573C3,3,FALSE))=TRUE,
0,VLOOKUP(RC8,'Mellon Download'!R2C1:R4573C3,3,FALSE))" ' - For Column
M
Target.Offset(0, 13).Value = "1" ' - For Column N
Target.Offset(0, 14).FormulaR1C1 = "=RC[-2]*RC[-1]" ' - For Column O
Target.Offset(0, 15).FormulaR1C1 = "=TODAY()" ' - For Column p
Target.Offset(0, 16).FormulaR1C1 = "=IF(RC[-1]="""","""",TODAY()-RC
[-1])" ' - For Column Q

Next C

End Su
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top