Code stopped working - help please

Jennifer Van

New Member
Joined
Apr 22, 2022
Messages
41
Office Version
  1. 2016
Platform
  1. Windows
I just received help and fixed the last code and now the first two have stopped working and I cannot work out why.

My main worksheet "Loan Request Return" records information and in column "Q" is a question with Yes/No answer to go to Waitlist - if this says yes then all the information from that row in cells A to Q to be copied and placed into the worksheet "Waitlist". This was automatically done once the Yes was put in the column.

The next piece of the code is the same, except it is om column "AD" that a question with Yes/No answer to go to Repairs - if this says yes then information cells in A,B,C,M,N,O, to be copied into the worksheet "Repairs". This was also automatically done once the Yes was put in the column.

The code is not working now - can someone help me please.

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Count > 1 Then Exit Sub
If Not Intersect(Target, Columns(17)) Is Nothing And Target.Row >= 5 Then
If Target.Value = "Yes" Then
Range(Cells(Target.Row, "A"), Cells(Target.Row, "P")).Copy Sheets("WaitList").Range("A" & Rows.Count).End(3)(2)
End If
End If

If Not Intersect(Target, Columns(31)) Is Nothing And Target.Row >= 5 Then
Dim tr As Long: tr = Target.Row
If Target.Value = "Yes" Then
Cells(tr, "M").Resize(, 3).Copy Sheets("Repairs").Range("C" & Rows.Count).End(3)(2)
End If
End If

End Sub
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

If Target.Count > 1 Then Exit Sub
If Not Intersect(Target, Columns(14)) Is Nothing And Target.Row >= 5 Then

Dim Sval As Range, wsEL As Worksheet, wsLRR As Worksheet

Set wsLRR = Sheets("Loan Request Return")
Set wsEL = Sheets("Equipment Library")
Set Sval = wsEL.Columns("C:C").Find(Target.Value)

If Target.Value = Sval.Value Then
Target.Offset(, 9).Resize(, 4).Copy Sval.Offset(, 13)
End If
End If

End Sub
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
As a guess, if your codes were working OK then I suspect you have disabled events in another code in your project

Try running following code from standard module & see if resolves issue with your event codes

VBA Code:
Sub ResetEvents()
    Application.EnableEvents = True
End Sub

Dave
 
Upvote 0
As a guess, if your codes were working OK then I suspect you have disabled events in another code in your project

Try running following code from standard module & see if resolves issue with your event codes

VBA Code:
Sub ResetEvents()
    Application.EnableEvents = True
End Sub

Dave
 
Upvote 0
Hi Dave
No it didn't, the last code works but the first two still do not.
Jen
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,093
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top