Progress Bar with no loops

rickyguzman

New Member
Joined
Mar 22, 2023
Messages
7
Office Version
  1. 365
Platform
  1. Windows
First let me say I'm new to the world of VBA, so many post I'm not able to understand. Given said that, I have a macro that's not doing any calculations, but taking a workbook and creating a new one by extracting info and formatting the new one (add/copy tabs/deleting columns, deleting empty rows, etc...). It only takes a about 10-15 seconds to finish, but for some users that's an eternity. I have looks around and see ways to add a progress bar but nothing really works.
Please keep in mind that my macro probably can be more efficient, but that will be for another time.

Any suggestions with really simple steps will be w great help .

Thanks
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Hi @rickyguzman
Welcome to the MrExcel forum. Please accept my warmest greetings and sincere hope that all is well.


To help you put a progress bar, it is necessary to see the macro to see how to adapt the progress bar.

Or better yet, improve the macro so that the process is faster, without the need for a progress bar.

You can put the following here:
1. The Macro
2. A data sample of what you have in the book
3. The expected result.
If your information is sensitive, it is not necessary that you put real data, you can put generic data, the important thing is to see the structure of the sheet and to be able to test your macro.

Without those 3 it is completely difficult to help you.


Note XL2BB:
For the future, it would help greatly if you could give us the sample data in a form that we can copy to test with, rather that a picture.
MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in
Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.


Note Code Tag:
In future please use code tags when posting code.
How to Post Your VBA Code it makes your code easier to read and copy and it also maintains VBA formatting.

--------------
I hope to hear from you soon.
Respectfully
Dante Amor
--------------​
 
Last edited:
Upvote 0
Thanks Dante, as I mentioned on my post, the macro just pretty much formats the workbook by unhiding a few tabs so I can move them around into a new workbook and then keep formatting the new workbook, so there is really no test data I can provide. The main bulk of codes is moving tab to the new one workbook, the reason that needs to be done one by one, is because all tabs contains tables. Anyway, at this point I really will like to learn how to get the progress bar going so I can at least see something is working besides the cursor.

The main Workbook, contains information from about 50 countries but when the user clicks on a country, the end result will be a final workbook that contains only the country selected + additional tabs. I did find something where I needed to create the UserForm + a Module and add some codes in each portion on the codes where I think may be at specific percentage (5, 10, 25). In reality, I'm not too concern on the accuracy, but to show is doing something. the code below takes about 8-10 sec, but that may be a short time for us, but the user doesnt know if its actually working.

Thanks a lot for getting back to me so quickly.

Unfortunately I am not able to attached screenshots of the actual workbook, sorry about that.

Thanks

Sub Egypt_EG()
'Egypt_EG Macro
'Turning off Screen Updating to avoid flashing
Application.ScreenUpdating = False
'Unhidding all tabs
Sheets("Country_Filters").Visible = True
Sheets("Instructions").Visible = True
Sheets("Issues_Log").Visible = True
Sheets("Self_Service_Request_Types").Visible = True
Sheets("Pay_Codes").Visible = True
Sheets("HOliday_Calendar_Table").Visible = True
Sheets("Accrual_Codes").Visible = True
Sheets("CORE_IC_Notes").Visible = True
Sheets("EeT_Inbound_Load").Visible = True
Sheets("WFMgr_Inbound_Load").Visible = True
Sheets("GWFM_Outbound").Visible = True
Sheets("Country_Filters").Select
'Selecting the correct country
With ActiveWorkbook.SlicerCaches("Slicer_Egypt_EG")
.SlicerItems("X").Selected = True
.SlicerItems("(blank)").Selected = False
End With
'Copying the tab to a new workbook
Sheets("Combined_User_Stories").Select
Sheets("Combined_User_Stories").Copy
'Selecting the other countries and deleting them
Columns("AC:AL").Select
Selection.Delete Shift:=xlToLeft
Columns("AD:CZ").Select
Selection.Delete Shift:=xlToLeft
'Deleting Hidden Rows
Dim lastRow As Long
Dim iCntr As Long
lastRow = 1001
For iCntr = lastRow To 1 Step -1
If Rows(iCntr).Hidden = True Then Rows(iCntr).EntireRow.Delete
Next
'Clear All Filters in a Table in VBA
Dim ws As Worksheet
Dim sTable As String
Dim loTable As ListObject
sTable = "Table1"
Set ws = ActiveSheet
Set loTable = ws.ListObjects(sTable)
loTable.AutoFilter.ShowAllData
'Clear All Filters
If ActiveSheet.FilterMode = True Then
ActiveSheet.ShowAllData
End If
'Hide "Place Holder" Columns
Columns("M").Hidden = True
Columns("N").Hidden = True
Columns("V").Hidden = True
Columns("W").Hidden = True
Columns("AA").Hidden = True
Columns("AB").Hidden = True
'Saving country specific workbook on temp folder
Application.DisplayAlerts = False
Range("A1").Select
ActiveWorkbook.SaveAs ("C:\Temp\Egypt_EG.xlsx")
Application.DisplayAlerts = True
'Copying tabs to new workbook
Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Instructions").Select
Sheets("Instructions").Copy before:=Workbooks("Egypt_EG.xlsx").Sheets(1)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select
Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Issues_Log").Select
Sheets("Issues_Log").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select
Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("CORE_IC_Notes").Select
Sheets("CORE_IC_Notes").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select
Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Self_Service_Request_Types").Select
Sheets("Self_Service_Request_Types").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select
Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Pay_Codes").Select
Sheets("Pay_Codes").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select
Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Holiday_Calendar_Table").Select
Sheets("Holiday_Calendar_Table").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select
Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Accrual_Codes").Select
Sheets("Accrual_Codes").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select
Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("EeT_Inbound_Load").Select
Sheets("EeT_Inbound_Load").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select
Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("WFMgr_Inbound_Load").Select
Sheets("WFMgr_Inbound_Load").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select
Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("GWFM_Outbound").Select
Sheets("GWFM_Outbound").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select
Sheets("Instructions").Select
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select
'Diselecting Country
Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Country_Filters").Select
ActiveWorkbook.SlicerCaches("Slicer_Egypt_EG").ClearManualFilter
Sheets("Country_Selection").Select
Range("A1").Select
'Re-Hidding Tabs
Sheets("Instructions_Main").Select
Sheets("Country_Filters").Visible = False
Sheets("Instructions").Visible = False
Sheets("Issues_Log").Visible = False
Sheets("Self_Service_Request_Types").Visible = False
Sheets("Pay_Codes").Visible = False
Sheets("HOliday_Calendar_Table").Visible = False
Sheets("Accrual_Codes").Visible = False
Sheets("CORE_IC_Notes").Visible = False
Sheets("EeT_Inbound_Load").Visible = False
Sheets("WFMgr_Inbound_Load").Visible = False
Sheets("GWFM_Outbound").Visible = False
'Re-Saving Workbook
ActiveWorkbook.Close SaveChanges:=False
'Turning on Application Updating
Application.ScreenUpdating = True

End Sub
 
Upvote 0
You could declare a variable at the beginning of your code and set that variable equal to zero.

Then, as often as you want, update the variable to a number approaching 100.

Then just use the value of that variable to for your progress bar.
 
Upvote 0
You could declare a variable at the beginning of your code and set that variable equal to zero.

Then, as often as you want, update the variable to a number approaching 100.

Then just use the value of that variable to for your progress bar.
Thanks You you be able to provide a sample of how to write that? As yu can tell, I'm pretty new at this :)
 
Upvote 0
I don't know how you are displaying a progress bar.

But here is a way that will display the progress in the Status Bar, at the bottom of the screen.

This is different, by the way, than the way that I said using a variable with a value.

VBA Code:
Sub Egypt_EG()

'Egypt_EG Macro
'Turning off Screen Updating to avoid flashing
Application.ScreenUpdating = False
'Unhidding all tabs
Sheets("Country_Filters").Visible = True
Sheets("Instructions").Visible = True
Sheets("Issues_Log").Visible = True
Sheets("Self_Service_Request_Types").Visible = True
Sheets("Pay_Codes").Visible = True
Sheets("HOliday_Calendar_Table").Visible = True
Sheets("Accrual_Codes").Visible = True
Sheets("CORE_IC_Notes").Visible = True
Sheets("EeT_Inbound_Load").Visible = True
Sheets("WFMgr_Inbound_Load").Visible = True
Sheets("GWFM_Outbound").Visible = True
Sheets("Country_Filters").Select

Application.StatusBar = "5%"

'Selecting the correct country
With ActiveWorkbook.SlicerCaches("Slicer_Egypt_EG")
.SlicerItems("X").Selected = True
.SlicerItems("(blank)").Selected = False
End With
'Copying the tab to a new workbook
Sheets("Combined_User_Stories").Select
Sheets("Combined_User_Stories").Copy
'Selecting the other countries and deleting them
Columns("AC:AL").Select
Selection.Delete Shift:=xlToLeft
Columns("AD:CZ").Select
Selection.Delete Shift:=xlToLeft
'Deleting Hidden Rows
Dim lastRow As Long
Dim iCntr As Long
lastRow = 1001
For iCntr = lastRow To 1 Step -1
If Rows(iCntr).Hidden = True Then Rows(iCntr).EntireRow.Delete
Next

Application.StatusBar = "10%"

'Clear All Filters in a Table in VBA
Dim ws As Worksheet
Dim sTable As String
Dim loTable As ListObject
sTable = "Table1"
Set ws = ActiveSheet
Set loTable = ws.ListObjects(sTable)
loTable.AutoFilter.ShowAllData
'Clear All Filters
If ActiveSheet.FilterMode = True Then
ActiveSheet.ShowAllData
End If
'Hide "Place Holder" Columns
Columns("M").Hidden = True
Columns("N").Hidden = True
Columns("V").Hidden = True
Columns("W").Hidden = True
Columns("AA").Hidden = True
Columns("AB").Hidden = True

Application.StatusBar = "15%"

'Saving country specific workbook on temp folder
Application.DisplayAlerts = False
Range("A1").Select
ActiveWorkbook.SaveAs ("C:\Temp\Egypt_EG.xlsx")
Application.DisplayAlerts = True
'Copying tabs to new workbook
Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Instructions").Select
Sheets("Instructions").Copy before:=Workbooks("Egypt_EG.xlsx").Sheets(1)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

Application.StatusBar = "20%"

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Issues_Log").Select
Sheets("Issues_Log").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

Application.StatusBar = "30%"

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("CORE_IC_Notes").Select
Sheets("CORE_IC_Notes").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

Application.StatusBar = "40%"

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Self_Service_Request_Types").Select
Sheets("Self_Service_Request_Types").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

Application.StatusBar = "50%"

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Pay_Codes").Select
Sheets("Pay_Codes").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

Application.StatusBar = "60%"

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Holiday_Calendar_Table").Select
Sheets("Holiday_Calendar_Table").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

Application.StatusBar = "45%"

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Accrual_Codes").Select
Sheets("Accrual_Codes").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

Application.StatusBar = "70%"

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("EeT_Inbound_Load").Select
Sheets("EeT_Inbound_Load").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

Application.StatusBar = "80%"

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("WFMgr_Inbound_Load").Select
Sheets("WFMgr_Inbound_Load").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

Application.StatusBar = "90%"

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("GWFM_Outbound").Select
Sheets("GWFM_Outbound").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select
Sheets("Instructions").Select
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select
'Diselecting Country


Application.StatusBar = "95%"

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Country_Filters").Select
ActiveWorkbook.SlicerCaches("Slicer_Egypt_EG").ClearManualFilter
Sheets("Country_Selection").Select
Range("A1").Select
'Re-Hidding Tabs
Sheets("Instructions_Main").Select
Sheets("Country_Filters").Visible = False
Sheets("Instructions").Visible = False
Sheets("Issues_Log").Visible = False
Sheets("Self_Service_Request_Types").Visible = False
Sheets("Pay_Codes").Visible = False
Sheets("HOliday_Calendar_Table").Visible = False
Sheets("Accrual_Codes").Visible = False
Sheets("CORE_IC_Notes").Visible = False
Sheets("EeT_Inbound_Load").Visible = False
Sheets("WFMgr_Inbound_Load").Visible = False
Sheets("GWFM_Outbound").Visible = False
'Re-Saving Workbook
ActiveWorkbook.Close SaveChanges:=False
'Turning on Application Updating
Application.ScreenUpdating = True

Application.StatusBar = ""

End Sub
 
Upvote 0
I don't know how you are displaying a progress bar.

But here is a way that will display the progress in the Status Bar, at the bottom of the screen.

This is different, by the way, than the way that I said using a variable with a value.

VBA Code:
Sub Egypt_EG()

'Egypt_EG Macro
'Turning off Screen Updating to avoid flashing
Application.ScreenUpdating = False
'Unhidding all tabs
Sheets("Country_Filters").Visible = True
Sheets("Instructions").Visible = True
Sheets("Issues_Log").Visible = True
Sheets("Self_Service_Request_Types").Visible = True
Sheets("Pay_Codes").Visible = True
Sheets("HOliday_Calendar_Table").Visible = True
Sheets("Accrual_Codes").Visible = True
Sheets("CORE_IC_Notes").Visible = True
Sheets("EeT_Inbound_Load").Visible = True
Sheets("WFMgr_Inbound_Load").Visible = True
Sheets("GWFM_Outbound").Visible = True
Sheets("Country_Filters").Select

Application.StatusBar = "5%"

'Selecting the correct country
With ActiveWorkbook.SlicerCaches("Slicer_Egypt_EG")
.SlicerItems("X").Selected = True
.SlicerItems("(blank)").Selected = False
End With
'Copying the tab to a new workbook
Sheets("Combined_User_Stories").Select
Sheets("Combined_User_Stories").Copy
'Selecting the other countries and deleting them
Columns("AC:AL").Select
Selection.Delete Shift:=xlToLeft
Columns("AD:CZ").Select
Selection.Delete Shift:=xlToLeft
'Deleting Hidden Rows
Dim lastRow As Long
Dim iCntr As Long
lastRow = 1001
For iCntr = lastRow To 1 Step -1
If Rows(iCntr).Hidden = True Then Rows(iCntr).EntireRow.Delete
Next

Application.StatusBar = "10%"

'Clear All Filters in a Table in VBA
Dim ws As Worksheet
Dim sTable As String
Dim loTable As ListObject
sTable = "Table1"
Set ws = ActiveSheet
Set loTable = ws.ListObjects(sTable)
loTable.AutoFilter.ShowAllData
'Clear All Filters
If ActiveSheet.FilterMode = True Then
ActiveSheet.ShowAllData
End If
'Hide "Place Holder" Columns
Columns("M").Hidden = True
Columns("N").Hidden = True
Columns("V").Hidden = True
Columns("W").Hidden = True
Columns("AA").Hidden = True
Columns("AB").Hidden = True

Application.StatusBar = "15%"

'Saving country specific workbook on temp folder
Application.DisplayAlerts = False
Range("A1").Select
ActiveWorkbook.SaveAs ("C:\Temp\Egypt_EG.xlsx")
Application.DisplayAlerts = True
'Copying tabs to new workbook
Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Instructions").Select
Sheets("Instructions").Copy before:=Workbooks("Egypt_EG.xlsx").Sheets(1)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

Application.StatusBar = "20%"

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Issues_Log").Select
Sheets("Issues_Log").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

Application.StatusBar = "30%"

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("CORE_IC_Notes").Select
Sheets("CORE_IC_Notes").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

Application.StatusBar = "40%"

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Self_Service_Request_Types").Select
Sheets("Self_Service_Request_Types").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

Application.StatusBar = "50%"

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Pay_Codes").Select
Sheets("Pay_Codes").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

Application.StatusBar = "60%"

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Holiday_Calendar_Table").Select
Sheets("Holiday_Calendar_Table").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

Application.StatusBar = "45%"

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Accrual_Codes").Select
Sheets("Accrual_Codes").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

Application.StatusBar = "70%"

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("EeT_Inbound_Load").Select
Sheets("EeT_Inbound_Load").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

Application.StatusBar = "80%"

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("WFMgr_Inbound_Load").Select
Sheets("WFMgr_Inbound_Load").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

Application.StatusBar = "90%"

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("GWFM_Outbound").Select
Sheets("GWFM_Outbound").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select
Sheets("Instructions").Select
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select
'Diselecting Country


Application.StatusBar = "95%"

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Country_Filters").Select
ActiveWorkbook.SlicerCaches("Slicer_Egypt_EG").ClearManualFilter
Sheets("Country_Selection").Select
Range("A1").Select
'Re-Hidding Tabs
Sheets("Instructions_Main").Select
Sheets("Country_Filters").Visible = False
Sheets("Instructions").Visible = False
Sheets("Issues_Log").Visible = False
Sheets("Self_Service_Request_Types").Visible = False
Sheets("Pay_Codes").Visible = False
Sheets("HOliday_Calendar_Table").Visible = False
Sheets("Accrual_Codes").Visible = False
Sheets("CORE_IC_Notes").Visible = False
Sheets("EeT_Inbound_Load").Visible = False
Sheets("WFMgr_Inbound_Load").Visible = False
Sheets("GWFM_Outbound").Visible = False
'Re-Saving Workbook
ActiveWorkbook.Close SaveChanges:=False
'Turning on Application Updating
Application.ScreenUpdating = True

Application.StatusBar = ""

End Sub
Thanks! That seems easy enough...would you mind also share your other idea using the Progress Bar variable? Just trying to learn and this seems to be the closer I've gotten in a while.

Thanks
 
Upvote 0
I was trying to hint for you to tell me how you are displaying your progress bar.

Since I still don't know. Here is one way.

In the VBA editor, insert a userform. You should be able to see the Toolbox window that allows you to add controls to your userform. If not, click on View in the toolbar and select Toolbox. Right click on the toolbox and select Additional Controls. Check the 'Microsoft Progress Bar' control. This will add the progress bar control to your userform. You can resize the progress bar control to your liking. After you've done that, you can adjust the code as below to display the userform and update the value of the progress bar control as the code runs.

VBA Code:
Sub Egypt_EG()
UserForm1.Show


'Egypt_EG Macro
'Turning off Screen Updating to avoid flashing
Application.ScreenUpdating = False
'Unhidding all tabs
Sheets("Country_Filters").Visible = True
Sheets("Instructions").Visible = True
Sheets("Issues_Log").Visible = True
Sheets("Self_Service_Request_Types").Visible = True
Sheets("Pay_Codes").Visible = True
Sheets("HOliday_Calendar_Table").Visible = True
Sheets("Accrual_Codes").Visible = True
Sheets("CORE_IC_Notes").Visible = True
Sheets("EeT_Inbound_Load").Visible = True
Sheets("WFMgr_Inbound_Load").Visible = True
Sheets("GWFM_Outbound").Visible = True
Sheets("Country_Filters").Select

UserForm1.ProgressBar1.Value = 5

'Selecting the correct country
With ActiveWorkbook.SlicerCaches("Slicer_Egypt_EG")
.SlicerItems("X").Selected = True
.SlicerItems("(blank)").Selected = False
End With
'Copying the tab to a new workbook
Sheets("Combined_User_Stories").Select
Sheets("Combined_User_Stories").Copy
'Selecting the other countries and deleting them
Columns("AC:AL").Select
Selection.Delete Shift:=xlToLeft
Columns("AD:CZ").Select
Selection.Delete Shift:=xlToLeft
'Deleting Hidden Rows
Dim lastRow As Long
Dim iCntr As Long
lastRow = 1001
For iCntr = lastRow To 1 Step -1
If Rows(iCntr).Hidden = True Then Rows(iCntr).EntireRow.Delete
Next

UserForm1.ProgressBar1.Value = 10

'Clear All Filters in a Table in VBA
Dim ws As Worksheet
Dim sTable As String
Dim loTable As ListObject
sTable = "Table1"
Set ws = ActiveSheet
Set loTable = ws.ListObjects(sTable)
loTable.AutoFilter.ShowAllData
'Clear All Filters
If ActiveSheet.FilterMode = True Then
ActiveSheet.ShowAllData
End If
'Hide "Place Holder" Columns
Columns("M").Hidden = True
Columns("N").Hidden = True
Columns("V").Hidden = True
Columns("W").Hidden = True
Columns("AA").Hidden = True
Columns("AB").Hidden = True

UserForm1.ProgressBar1.Value = 15

'Saving country specific workbook on temp folder
Application.DisplayAlerts = False
Range("A1").Select
ActiveWorkbook.SaveAs ("C:\Temp\Egypt_EG.xlsx")
Application.DisplayAlerts = True
'Copying tabs to new workbook
Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Instructions").Select
Sheets("Instructions").Copy before:=Workbooks("Egypt_EG.xlsx").Sheets(1)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 20

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Issues_Log").Select
Sheets("Issues_Log").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 30

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("CORE_IC_Notes").Select
Sheets("CORE_IC_Notes").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 40

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Self_Service_Request_Types").Select
Sheets("Self_Service_Request_Types").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 50

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Pay_Codes").Select
Sheets("Pay_Codes").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 60

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Holiday_Calendar_Table").Select
Sheets("Holiday_Calendar_Table").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 65

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Accrual_Codes").Select
Sheets("Accrual_Codes").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 70

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("EeT_Inbound_Load").Select
Sheets("EeT_Inbound_Load").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 80

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("WFMgr_Inbound_Load").Select
Sheets("WFMgr_Inbound_Load").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 90

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("GWFM_Outbound").Select
Sheets("GWFM_Outbound").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select
Sheets("Instructions").Select
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select
'Diselecting Country


UserForm1.ProgressBar1.Value = 95

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Country_Filters").Select
ActiveWorkbook.SlicerCaches("Slicer_Egypt_EG").ClearManualFilter
Sheets("Country_Selection").Select
Range("A1").Select
'Re-Hidding Tabs
Sheets("Instructions_Main").Select
Sheets("Country_Filters").Visible = False
Sheets("Instructions").Visible = False
Sheets("Issues_Log").Visible = False
Sheets("Self_Service_Request_Types").Visible = False
Sheets("Pay_Codes").Visible = False
Sheets("HOliday_Calendar_Table").Visible = False
Sheets("Accrual_Codes").Visible = False
Sheets("CORE_IC_Notes").Visible = False
Sheets("EeT_Inbound_Load").Visible = False
Sheets("WFMgr_Inbound_Load").Visible = False
Sheets("GWFM_Outbound").Visible = False
'Re-Saving Workbook
ActiveWorkbook.Close SaveChanges:=False
'Turning on Application Updating
Application.ScreenUpdating = True

UserForm1.Hide
End Sub
 
Upvote 0
I was trying to hint for you to tell me how you are displaying your progress bar.

Since I still don't know. Here is one way.

In the VBA editor, insert a userform. You should be able to see the Toolbox window that allows you to add controls to your userform. If not, click on View in the toolbar and select Toolbox. Right click on the toolbox and select Additional Controls. Check the 'Microsoft Progress Bar' control. This will add the progress bar control to your userform. You can resize the progress bar control to your liking. After you've done that, you can adjust the code as below to display the userform and update the value of the progress bar control as the code runs.

VBA Code:
Sub Egypt_EG()
UserForm1.Show


'Egypt_EG Macro
'Turning off Screen Updating to avoid flashing
Application.ScreenUpdating = False
'Unhidding all tabs
Sheets("Country_Filters").Visible = True
Sheets("Instructions").Visible = True
Sheets("Issues_Log").Visible = True
Sheets("Self_Service_Request_Types").Visible = True
Sheets("Pay_Codes").Visible = True
Sheets("HOliday_Calendar_Table").Visible = True
Sheets("Accrual_Codes").Visible = True
Sheets("CORE_IC_Notes").Visible = True
Sheets("EeT_Inbound_Load").Visible = True
Sheets("WFMgr_Inbound_Load").Visible = True
Sheets("GWFM_Outbound").Visible = True
Sheets("Country_Filters").Select

UserForm1.ProgressBar1.Value = 5

'Selecting the correct country
With ActiveWorkbook.SlicerCaches("Slicer_Egypt_EG")
.SlicerItems("X").Selected = True
.SlicerItems("(blank)").Selected = False
End With
'Copying the tab to a new workbook
Sheets("Combined_User_Stories").Select
Sheets("Combined_User_Stories").Copy
'Selecting the other countries and deleting them
Columns("AC:AL").Select
Selection.Delete Shift:=xlToLeft
Columns("AD:CZ").Select
Selection.Delete Shift:=xlToLeft
'Deleting Hidden Rows
Dim lastRow As Long
Dim iCntr As Long
lastRow = 1001
For iCntr = lastRow To 1 Step -1
If Rows(iCntr).Hidden = True Then Rows(iCntr).EntireRow.Delete
Next

UserForm1.ProgressBar1.Value = 10

'Clear All Filters in a Table in VBA
Dim ws As Worksheet
Dim sTable As String
Dim loTable As ListObject
sTable = "Table1"
Set ws = ActiveSheet
Set loTable = ws.ListObjects(sTable)
loTable.AutoFilter.ShowAllData
'Clear All Filters
If ActiveSheet.FilterMode = True Then
ActiveSheet.ShowAllData
End If
'Hide "Place Holder" Columns
Columns("M").Hidden = True
Columns("N").Hidden = True
Columns("V").Hidden = True
Columns("W").Hidden = True
Columns("AA").Hidden = True
Columns("AB").Hidden = True

UserForm1.ProgressBar1.Value = 15

'Saving country specific workbook on temp folder
Application.DisplayAlerts = False
Range("A1").Select
ActiveWorkbook.SaveAs ("C:\Temp\Egypt_EG.xlsx")
Application.DisplayAlerts = True
'Copying tabs to new workbook
Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Instructions").Select
Sheets("Instructions").Copy before:=Workbooks("Egypt_EG.xlsx").Sheets(1)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 20

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Issues_Log").Select
Sheets("Issues_Log").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 30

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("CORE_IC_Notes").Select
Sheets("CORE_IC_Notes").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 40

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Self_Service_Request_Types").Select
Sheets("Self_Service_Request_Types").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 50

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Pay_Codes").Select
Sheets("Pay_Codes").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 60

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Holiday_Calendar_Table").Select
Sheets("Holiday_Calendar_Table").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 65

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Accrual_Codes").Select
Sheets("Accrual_Codes").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 70

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("EeT_Inbound_Load").Select
Sheets("EeT_Inbound_Load").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 80

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("WFMgr_Inbound_Load").Select
Sheets("WFMgr_Inbound_Load").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 90

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("GWFM_Outbound").Select
Sheets("GWFM_Outbound").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select
Sheets("Instructions").Select
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select
'Diselecting Country


UserForm1.ProgressBar1.Value = 95

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Country_Filters").Select
ActiveWorkbook.SlicerCaches("Slicer_Egypt_EG").ClearManualFilter
Sheets("Country_Selection").Select
Range("A1").Select
'Re-Hidding Tabs
Sheets("Instructions_Main").Select
Sheets("Country_Filters").Visible = False
Sheets("Instructions").Visible = False
Sheets("Issues_Log").Visible = False
Sheets("Self_Service_Request_Types").Visible = False
Sheets("Pay_Codes").Visible = False
Sheets("HOliday_Calendar_Table").Visible = False
Sheets("Accrual_Codes").Visible = False
Sheets("CORE_IC_Notes").Visible = False
Sheets("EeT_Inbound_Load").Visible = False
Sheets("WFMgr_Inbound_Load").Visible = False
Sheets("GWFM_Outbound").Visible = False
'Re-Saving Workbook
ActiveWorkbook.Close SaveChanges:=False
'Turning on Application Updating
Application.ScreenUpdating = True

UserForm1.Hide
End Sub

I was trying to hint for you to tell me how you are displaying your progress bar.

Since I still don't know. Here is one way.

In the VBA editor, insert a userform. You should be able to see the Toolbox window that allows you to add controls to your userform. If not, click on View in the toolbar and select Toolbox. Right click on the toolbox and select Additional Controls. Check the 'Microsoft Progress Bar' control. This will add the progress bar control to your userform. You can resize the progress bar control to your liking. After you've done that, you can adjust the code as below to display the userform and update the value of the progress bar control as the code runs.

VBA Code:
Sub Egypt_EG()
UserForm1.Show


'Egypt_EG Macro
'Turning off Screen Updating to avoid flashing
Application.ScreenUpdating = False
'Unhidding all tabs
Sheets("Country_Filters").Visible = True
Sheets("Instructions").Visible = True
Sheets("Issues_Log").Visible = True
Sheets("Self_Service_Request_Types").Visible = True
Sheets("Pay_Codes").Visible = True
Sheets("HOliday_Calendar_Table").Visible = True
Sheets("Accrual_Codes").Visible = True
Sheets("CORE_IC_Notes").Visible = True
Sheets("EeT_Inbound_Load").Visible = True
Sheets("WFMgr_Inbound_Load").Visible = True
Sheets("GWFM_Outbound").Visible = True
Sheets("Country_Filters").Select

UserForm1.ProgressBar1.Value = 5

'Selecting the correct country
With ActiveWorkbook.SlicerCaches("Slicer_Egypt_EG")
.SlicerItems("X").Selected = True
.SlicerItems("(blank)").Selected = False
End With
'Copying the tab to a new workbook
Sheets("Combined_User_Stories").Select
Sheets("Combined_User_Stories").Copy
'Selecting the other countries and deleting them
Columns("AC:AL").Select
Selection.Delete Shift:=xlToLeft
Columns("AD:CZ").Select
Selection.Delete Shift:=xlToLeft
'Deleting Hidden Rows
Dim lastRow As Long
Dim iCntr As Long
lastRow = 1001
For iCntr = lastRow To 1 Step -1
If Rows(iCntr).Hidden = True Then Rows(iCntr).EntireRow.Delete
Next

UserForm1.ProgressBar1.Value = 10

'Clear All Filters in a Table in VBA
Dim ws As Worksheet
Dim sTable As String
Dim loTable As ListObject
sTable = "Table1"
Set ws = ActiveSheet
Set loTable = ws.ListObjects(sTable)
loTable.AutoFilter.ShowAllData
'Clear All Filters
If ActiveSheet.FilterMode = True Then
ActiveSheet.ShowAllData
End If
'Hide "Place Holder" Columns
Columns("M").Hidden = True
Columns("N").Hidden = True
Columns("V").Hidden = True
Columns("W").Hidden = True
Columns("AA").Hidden = True
Columns("AB").Hidden = True

UserForm1.ProgressBar1.Value = 15

'Saving country specific workbook on temp folder
Application.DisplayAlerts = False
Range("A1").Select
ActiveWorkbook.SaveAs ("C:\Temp\Egypt_EG.xlsx")
Application.DisplayAlerts = True
'Copying tabs to new workbook
Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Instructions").Select
Sheets("Instructions").Copy before:=Workbooks("Egypt_EG.xlsx").Sheets(1)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 20

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Issues_Log").Select
Sheets("Issues_Log").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 30

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("CORE_IC_Notes").Select
Sheets("CORE_IC_Notes").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 40

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Self_Service_Request_Types").Select
Sheets("Self_Service_Request_Types").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 50

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Pay_Codes").Select
Sheets("Pay_Codes").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 60

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Holiday_Calendar_Table").Select
Sheets("Holiday_Calendar_Table").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 65

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Accrual_Codes").Select
Sheets("Accrual_Codes").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 70

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("EeT_Inbound_Load").Select
Sheets("EeT_Inbound_Load").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 80

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("WFMgr_Inbound_Load").Select
Sheets("WFMgr_Inbound_Load").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

UserForm1.ProgressBar1.Value = 90

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("GWFM_Outbound").Select
Sheets("GWFM_Outbound").Copy After:=Workbooks("Egypt_EG.xlsx").Sheets(Workbooks("Egypt_EG.xlsx").Sheets.Count)
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select
Sheets("Instructions").Select
Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select
'Diselecting Country


UserForm1.ProgressBar1.Value = 95

Windows("GWFMI99_Master_UserStoryWorkbook.xlsm").Activate
Sheets("Country_Filters").Select
ActiveWorkbook.SlicerCaches("Slicer_Egypt_EG").ClearManualFilter
Sheets("Country_Selection").Select
Range("A1").Select
'Re-Hidding Tabs
Sheets("Instructions_Main").Select
Sheets("Country_Filters").Visible = False
Sheets("Instructions").Visible = False
Sheets("Issues_Log").Visible = False
Sheets("Self_Service_Request_Types").Visible = False
Sheets("Pay_Codes").Visible = False
Sheets("HOliday_Calendar_Table").Visible = False
Sheets("Accrual_Codes").Visible = False
Sheets("CORE_IC_Notes").Visible = False
Sheets("EeT_Inbound_Load").Visible = False
Sheets("WFMgr_Inbound_Load").Visible = False
Sheets("GWFM_Outbound").Visible = False
'Re-Saving Workbook
ActiveWorkbook.Close SaveChanges:=False
'Turning on Application Updating
Application.ScreenUpdating = True

UserForm1.Hide
End Sub
Thanks. It seems to be what I needed but most be missing something. When I start the Macro, the Precess Bas shows up but the Marcro freezes. If I Xout on the Pregress Bar, then the macro continues to work as normal.
1688082696195.png

Any suggestions?

Thanks
 
Upvote 0
Hello @rickyguzman

I think the biggest problem is deleting rows and columns from a filtered table.
I changed the approach. It no longer removes rows, I'm just copying the visible data from Table1.​
Obviously I did tests with an imaginary sample of data.​

Review the result in the file and tell me.
Also tell me if the processing time improved.​

Try the following code.
There are 2 macros, copy all the code in a module and execute the "Egypt_EG" macro.​

VBA Code:
Sub Egypt_EG()
'Egypt_EG Macro
  Dim wb1 As Workbook, wb2 As Workbook
  Dim sh1 As Worksheet, sh2 As Worksheet
  Dim tb1 As ListObject, tb2 As ListObject
  Dim arr As Variant, i As Long

  'Settings
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
    Set wb1 = ThisWorkbook
    Set sh1 = wb1.Sheets("Combined_User_Stories")
    Set tb1 = sh1.ListObjects("Table1")
    arr = Array("Country_Filters", "Instructions", "Combined_User_Stories", "Issues_Log", _
          "CORE_IC_Notes", "Self_Service_Request_Types", "Pay_Codes", "Holiday_Calendar_Table", _
          "Accrual_Codes", "EeT_Inbound_Load", "WFMgr_Inbound_Load", "GWFM_Outbound")
 
  'Unhidding all tabs
    Call hide_unhide_tabs(wb1, arr, True)
 
  'Selecting the correct country
    With wb1.SlicerCaches("Slicer_Egypt_EG")
      .SlicerItems("X").Selected = True
      .SlicerItems("(blank)").Selected = False
    End With
 
  'Copying the tabs to a new workbook
    For i = 1 To UBound(arr)
      If i = 1 Then
        wb1.Sheets(arr(i)).Copy
        Set wb2 = ActiveWorkbook
      Else
        wb1.Sheets(arr(i)).Copy After:=wb2.Sheets(wb2.Sheets.Count)
      End If
    Next
 
  'Clear All Filters
    Set sh2 = wb2.Sheets("Combined_User_Stories")
    Set tb2 = sh2.ListObjects("Table1")
    tb2.AutoFilter.ShowAllData
    If sh2.FilterMode = True Then sh2.ShowAllData
    With tb2.DataBodyRange
      If .Rows.Count > 1 Then
        .Offset(1, 0).Resize(.Rows.Count - 1, .Columns.Count).Rows.Delete
      End If
      .Rows(1).SpecialCells(xlCellTypeConstants).ClearContents
      tb1.DataBodyRange.SpecialCells(xlCellTypeVisible).Copy .Cells(1)
    End With
 
  'Selecting the other countries and deleting them
    sh2.Range("AC:AL").Delete Shift:=xlToLeft
    Range("AD:CZ").Delete Shift:=xlToLeft

  'Hide "Place Holder" Columns
    sh2.Range("M:N,V:W,AA:AB").EntireColumn.Hidden = True
  
  'Saving country specific workbook on temp folder
    wb2.Sheets(1).Select
    wb2.SaveAs ("C:\temp\Egypt_EG.xlsx")
    wb2.Close SaveChanges:=False

  'Diselecting Country
    wb1.Activate
    wb1.SlicerCaches("Slicer_Egypt_EG").ClearManualFilter
    Sheets("Instructions_Main").Select

  'Re-Hidding Tabs
    Call hide_unhide_tabs(wb1, arr, False)
 
  Application.ScreenUpdating = True
  Application.DisplayAlerts = True
End Sub

Sub hide_unhide_tabs(wb1 As Workbook, arr As Variant, bln As Boolean)
  Dim ar As Variant
  For Each ar In arr
    If ar <> "Combined_User_Stories" Then wb1.Sheets(ar).Visible = bln
  Next
End Sub

Note:
And now that you know how to add the progress bar, you can put it in the new code. You may notice that each process has a comment.​
But I don't think it's necessary, the process should last a couple of seconds.​
--------------
Cordially
Dante Amor
--------------​
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,159
Members
453,021
Latest member
Justyna P

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