Livin404
Well-known Member
- Joined
- Jan 7, 2019
- Messages
- 743
- Office Version
- 365
- 2019
- Platform
- Windows
Hello,
I am hoping I can combine three macros into one. The macros are to save data after it is entered in to database (User Form) , the second will re-sequence the database in ascending order, and lastly since these are all fed into a Pivot Table - the last macro is the refresh. This will all be done when the Command Button "Save". If I could only get two then it would definitely be the first two. I cannot have people going to the database and trying to manually re-sequence them.
I am hoping I can combine three macros into one. The macros are to save data after it is entered in to database (User Form) , the second will re-sequence the database in ascending order, and lastly since these are all fed into a Pivot Table - the last macro is the refresh. This will all be done when the Command Button "Save". If I could only get two then it would definitely be the first two. I cannot have people going to the database and trying to manually re-sequence them.
VBA Code:
Private Sub CMDSAVE_Click()
Dim msgValue As VbMsgBoxResult
msgValue = MsgBox("Do you want to save Mission?", vbYesNo + vbInformation, "Confirmation")
If msgValue = vbNo Then Exit Sub
Call Submit
Call RESET
End Sub
VBA Code:
Private Sub CMDSAVE_Click()
Dim xlSort As XlSortOrder
Dim LastRow As Long
With Sheets("ACTIVITY")
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
.Range("A1") = "Date"
.Columns("A:F").Sort key1:=.Range("A2"), order1:=xlAscending, Header:=xlYes
End With
End Sub
VBA Code:
Sub RefreshPivotsOnly()
Dim tblPivot As PivotTable
For Each tblPivot In ActiveWorkbook.PivotTables
tblPivot.RefreshTable
Next tblPivot
End Sub