luthersonus
New Member
- Joined
- May 4, 2022
- Messages
- 5
- Office Version
- 365
- Platform
- Windows
Hi,
I have several codes that I've pieced together (I'm a beginner). I have 2 tabs. One with a table named Append1 and the other tab is named "Drop". In the Append1 table, I indicate if a student has dropped by putting in "Drop" in Column 1 (the table begins at A6). I then need all the dropped students to be moved to the Drop Tab, duplicates removed and deleted from the Append1 table. I want it to do all this every time I open the workbook once data has been refreshed.
What I have put together works, except that for one thing. It deletes the Drops from the Append1 table after moving to the drop tab, however after it deletes them, it adds them back to the Append1 table. Any advice would be appreciated!
Thank you
Sub Workbook_RefreshAll()
ActiveWorkbook.RefreshAll
MsgBox "Data has been refreshed!"
Dim wsUse As Worksheet
Dim wsDc As Worksheet
Dim strdc As String
Application.ScreenUpdating = False
Application.Calculation = xlCalculationAutomatic
Call HighlightDrops
End Sub
Sub HighlightDrops()
HighlightDrops Macro
Range("Append1[Drop]").Select
Call MoveDrops
End Sub
Sub MoveDrops()
For Each myCell In Selection.Columns(1).Cells
If myCell.Value = "Drop" Then
myCell.EntireRow.Copy Worksheets("Drops").Range("A" & Rows.Count).End(3)(2)
myCell.EntireRow.Delete
End If
Next
Call RemoveDups
End Sub
Sub RemoveDups()
RemoveDups Macro
Sheets("Drops").Select
Range("A1").Select
ActiveSheet.Range("$A$1:$AA$500").RemoveDuplicates Columns:=2, Header:=xlYes
Sheets("WABERS.Tuition Sum 22").Select
Range("Append1[[#Headers],[Drop]]").Select
End Sub
I have several codes that I've pieced together (I'm a beginner). I have 2 tabs. One with a table named Append1 and the other tab is named "Drop". In the Append1 table, I indicate if a student has dropped by putting in "Drop" in Column 1 (the table begins at A6). I then need all the dropped students to be moved to the Drop Tab, duplicates removed and deleted from the Append1 table. I want it to do all this every time I open the workbook once data has been refreshed.
What I have put together works, except that for one thing. It deletes the Drops from the Append1 table after moving to the drop tab, however after it deletes them, it adds them back to the Append1 table. Any advice would be appreciated!
Thank you
Sub Workbook_RefreshAll()
ActiveWorkbook.RefreshAll
MsgBox "Data has been refreshed!"
Dim wsUse As Worksheet
Dim wsDc As Worksheet
Dim strdc As String
Application.ScreenUpdating = False
Application.Calculation = xlCalculationAutomatic
Call HighlightDrops
End Sub
Sub HighlightDrops()
HighlightDrops Macro
Range("Append1[Drop]").Select
Call MoveDrops
End Sub
Sub MoveDrops()
For Each myCell In Selection.Columns(1).Cells
If myCell.Value = "Drop" Then
myCell.EntireRow.Copy Worksheets("Drops").Range("A" & Rows.Count).End(3)(2)
myCell.EntireRow.Delete
End If
Next
Call RemoveDups
End Sub
Sub RemoveDups()
RemoveDups Macro
Sheets("Drops").Select
Range("A1").Select
ActiveSheet.Range("$A$1:$AA$500").RemoveDuplicates Columns:=2, Header:=xlYes
Sheets("WABERS.Tuition Sum 22").Select
Range("Append1[[#Headers],[Drop]]").Select
End Sub