amoverton2
Board Regular
- Joined
- May 13, 2021
- Messages
- 77
- Office Version
- 2016
- Platform
- Windows
Hi all!
So out of the blue I'm starting to get a run-time error with this code (Run Time Error 1004: Select Method of Range class failed) that used to have no issues... Can someone tell me why, or how to fix or change the code???
Note: I did try doing the suggested ways of fixing it to no avail via other posts and other online posts
Thank you!!!
So out of the blue I'm starting to get a run-time error with this code (Run Time Error 1004: Select Method of Range class failed) that used to have no issues... Can someone tell me why, or how to fix or change the code???
Note: I did try doing the suggested ways of fixing it to no avail via other posts and other online posts
VBA Code:
Private Sub cmdDELETE_Click()
Dim account As String
Dim r As Long
If cmbDELNAME.Text = "" Then
MsgBox "Enter Account Number"
End If
account = Trim(cmbDELNAME.Text)
r = 2
Worksheets("O_ProspectiveGain_Add").activate
Do While Worksheets("O_ProspectiveGain_Add").Cells(r, 2) <> ""
If Worksheets("O_ProspectiveGain_Add").Cells(r, 2).Value = account Then
Worksheets("O_ProspectiveGain_Add").Cells(r, 2).Select
ActiveCell.EntireRow.Delete Shift:=xlUp
End If
r = r + 1
Loop
Worksheets("O_Sponsor_Add").activate
r = 2
Do While Worksheets("O_Sponsor_Add").Cells(r, 2) <> ""
If Worksheets("O_Sponsor_Add").Cells(r, 2).Value = account Then
Worksheets("O_Sponsor_Add").Cells(r, 2).Select
ActiveCell.EntireRow.Delete Shift:=xlUp
End If
r = r + 1
Loop
Worksheets("O_AdminInfoGain_Add").activate
r = 2
Do While Worksheets("O_AdminInfoGain_Add").Cells(r, 2) <> ""
If Worksheets("O_AdminInfoGain_Add").Cells(r, 2).Value = account Then
Worksheets("O_AdminInfoGain_Add").Cells(r, 2).Select
ActiveCell.EntireRow.Delete Shift:=xlUp
End If
r = r + 1
Loop
Worksheets("O_LastContact_Add").activate
r = 2
Do While Worksheets("O_LastContact_Add").Cells(r, 2) <> ""
If Worksheets("O_LastContact_Add").Cells(r, 2).Value = account Then
Worksheets("O_LastContact_Add").Cells(r, 2).Select
ActiveCell.EntireRow.Delete Shift:=xlUp
End If
r = r + 1
Loop
Worksheets("O_TravelInfo_Add").activate
r = 2
Do While Worksheets("O_TravelInfo_Add").Cells(r, 2) <> ""
If Worksheets("O_TravelInfo_Add").Cells(r, 2).Value = account Then
Worksheets("O_TravelInfo_Add").Cells(r, 2).Select
ActiveCell.EntireRow.Delete Shift:=xlUp
End If
r = r + 1
Loop
Worksheets("O_FamilyInfo_Add").activate
r = 2
Do While Worksheets("O_FamilyInfo_Add").Cells(r, 2) <> ""
If Worksheets("O_FamilyInfo_Add").Cells(r, 2).Value = account Then
Worksheets("O_FamilyInfo_Add").Cells(r, 2).Select
ActiveCell.EntireRow.Delete Shift:=xlUp
End If
r = r + 1
Loop
Worksheets("O_MiscNotes_Add").activate
r = 2
Do While Worksheets("O_MiscNotes_Add").Cells(r, 2) <> ""
If Worksheets("O_MiscNotes_Add").Cells(r, 2).Value = account Then
Worksheets("O_MiscNotes_Add").Cells(r, 2).Select
ActiveCell.EntireRow.Delete Shift:=xlUp
End If
r = r + 1
Loop
MsgBox "Member Deleted"
ThisWorkbook.Save
MsgBox "Saved"
End Sub
Thank you!!!