Show result cleaning sheet

Watersource

New Member
Joined
Jan 3, 2009
Messages
17
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hello,

I have created a VBA macro that first cleans the content of the sheets and then fills the sheet with new data again. As quite a lot of data is gathered, I have tried to show that cleaning the content has finished (by putting .ScreenUpdating to True and False again) but this does not work yet. No updating takes place during running of this macro, only when it is finished. Could you give me some pointers how to achieve this.

VBA Code:
Sub Refresh_Data()

Dim sht As Worksheet
Dim shtActiveSht As Worksheet

Set shtActiveSht = ActiveSheet

With Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
On Error Resume Next

ClearSheets --sub to clear contents

.ScreenUpdating = True
.ScreenUpdating = False

On Error GoTo 0
.Run ("EG2000.XLA!ThisWorkbook.AddIn_OnRefresh")

.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
MsgBox ("The reports have been updated.")
End With

End Sub

Thanks for your help on this.
 
Last edited:

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
May not be able to do exatly what you want. But may be able to offer something to give user comfort
Please post macro ClearSheets
 
Upvote 0
May not be able to do exatly what you want. But may be able to offer something to give user comfort
Please post macro ClearSheets
The ClearSheets macro is the following:
VBA Code:
Sub ClearSheets()

Dim lastrow As Long
Dim sht As Worksheet
Dim shtActiveSht As Worksheet
Set shtActiveSht = ActiveSheet

For Each sht In ActiveWorkbook.Worksheets
    sht.Activate
        Range("A10").Select
        lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
        Rows("10:" & lastrow).ClearContents
    Next sht
shtActiveSht.Activate

End Sub

Just to be complete, we use Excel 2016.
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,739
Members
448,989
Latest member
mariah3

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