ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   The code below worked for a few days and just totally stoppedworking. (https://www.excelbanter.com/excel-worksheet-functions/249316-code-below-worked-few-days-just-totally-stoppedworking.html)

Damil4real

The code below worked for a few days and just totally stoppedworking.
 
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(RC 8,'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



Don Guillett

The code below worked for a few days and just totally stopped working.
 
Try running this or leave Excel and come back

sub fixit()
application.enableevents=true
end sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Damil4real" wrote in message
...
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(RC 8,'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





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com