"Timer" required??

rabarnes

New Member
Joined
Sep 7, 2006
Messages
26
Hi

I have written a spreadsheet which is linked into a datasource and I have set the data to automatically update when the spreadsheet is opened. However my data is fairly large and the spreadsheet contains a lot of formulae, meaning it takes up to 10 seconds to update and calculate the cells. This doesn't sound a lot but when waiting for something, it is!

The likes of you and me (who know how Excel works) are intellegent enough to realise that there is a toolbar at the bottom of the screen which tells you that the datasource is being connected to, along with a small "globe" logo telling you that the data is being updated. However the people who use the spreadsheet (my sales team) do not have as good an understanding of Excel as you or I do, so they don't realise that things are happening in the background and get frustrated waiting for the spreadsheet to open.

I see two possible solutions to this problem which I'm hoping someone can give me the answer to:

1. Create some sort of "Timer" which pops up in the middle of the screen replicating what is being done in the toolbar at the bottom. This way the user will know that something is happening.

Or

2. Find some way of speeding up the updating of data / calculating of cells.

Can anyone help??

Thanks

Rowan
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
rabarnes

This is not my strongest point but in the absence of other suggestions you could try something like this.

<font face=Courier New>    Columns("A:IU").EntireColumn.Hidden = <SPAN style="color:#00007F">True</SPAN>
    <SPAN style="color:#00007F">With</SPAN> Range("IV1")
        .ColumnWidth = 100
        .Font.Size = 22
        .Interior.ColorIndex = 35
        .Value = "Please be patient while data loads"
    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN>
    Application.ScreenUpdating = <SPAN style="color:#00007F">False</SPAN>
    
    <SPAN style="color:#00007F">With</SPAN> Application
        .Calculation = xlManual
    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN>
    
    <SPAN style="color:#007F00">'*** Your existing update code here ***</SPAN>
    
    <SPAN style="color:#00007F">With</SPAN> Application
        .Calculation = xlAutomatic
    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN>
    Columns("A:IU").EntireColumn.Hidden = <SPAN style="color:#00007F">False</SPAN>
    Columns("IV").EntireColumn.Delete
    Application.ScreenUpdating = <SPAN style="color:#00007F">True</SPAN></FONT>
 
Upvote 0
.. unfortunately this didn't work.
In what way? (I am not suggestion that you are wrong with this statement, but it doesn't give us much to move forward with)
Did it give an error? If so, what error?
Did it not speed things up?
Did the users still not realise something was happening in the background?
Where did you put this code and how was it triggered?
Would it be possible to see the rest of your code?
 
Upvote 0
Hi Peter

Here is my code:

Private Sub Workbook_Open()

Columns("A:IU").EntireColumn.Hidden = True
With Range("IV1")
.ColumnWidth = 100
.Font.Size = 22
.Interior.ColorIndex = 35
.Value = "Please be patient while data loads"
End With
Application.ScreenUpdating = False

With Application
.Calculation = xlManual
End With

Application.ScreenUpdating = False
Sheets("Database").Visible = True
ActiveWorkbook.RefreshAll
Sheets("Database").Select
ActiveWindow.SelectedSheets.Visible = False
Application.Selection = True
Sheets("Input Sheet").Select
Range("C5").Select

With Application
.Calculation = xlAutomatic
End With
Columns("A:IU").EntireColumn.Hidden = False
Columns("IV").EntireColumn.Delete
Application.ScreenUpdating = True

Sheets("Input Sheet").Select
Range("C5").Select
Selection.ClearContents

Sheets("Input Sheet").Select
Range("C9").Select
Selection.ClearContents
Range("C5").Select
Selection.ClearContents

End Sub


When I open the workbook I get:

Run-time error '1004':

Unable to set the Hidden property of the Range class

When I press debug, the top line, "Columns("A:IU").EntireColumn.Hidden = True", is highlighted.

Unfortunately, being quite new to VB, I am unsure as to what this means and how to fix it, or even whether my code is written out correctly.

Thanks for your help

Rowan
 
Upvote 0
I've ever so slightly reduced the clutter on the code:

Code:
Private Sub Workbook_Open()

Sheets("Input Sheet").Activate

Columns("A:IU").EntireColumn.Hidden = True
    
With Range("IV1")
    .ColumnWidth = 100
    .Font.Size = 22
    .Interior.ColorIndex = 35
    .Value = "Please be patient while data loads"
End With

With Application
    .Calculation = xlManual
    .ScreenUpdating = False
End With


Sheets("Database").Visible = True
ActiveWorkbook.RefreshAll
Sheets("Database").Visible = False

Sheets("Input Sheet").Activate

With Columns("A:IV")
    .EntireColumn.Hidden = False
    .Clear
End With

With Application
    .Calculation = xlAutomatic
    .ScreenUpdating = True
End With

End Sub

But it still won't work if there is worksheet protection, otherwise it seems to work fine for me.

Regards,
Jon :)
 
Upvote 0
What about

Msgbox ("Please wait while update proceeds")
Application.Wait Now + TimeValue("00:00:05")

'your code

Msgbox ("Update Complete")

??
 
Upvote 0
Hi Guys

Thanks for your help, I'm almost there. Mark, the only issue I have with your suggestion is that you have to press "OK" to the first message box before the data will begin to update. Is there a way of making a message box pop up while the data is loading without the "OK" button, such as "Please wait while data loads..." and then the "Update Complete" message box pops up once it has updated? Hope that makes sense!

Thanks again

Rowan
 
Upvote 0

Forum statistics

Threads
1,214,584
Messages
6,120,384
Members
448,956
Latest member
JPav

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