Solved

Code To Update/Refresh Spreadsheet

Posted on 2013-01-14
5
285 Views
Last Modified: 2013-01-16
Hello Experts!

I have no idea if this is even possible.  I am hoping there is a code that I could put into my spreadsheet, that (assuming macro's are enabled) this " code " looks at range E:I, and after any cell has been entered with a value, then the spreadsheet automatically refreshes itself.

The reason, is because I have a cell in my spreadsheet that references "=NOW()" - and I need that cell to refresh with the current value. Cause there are certain cells dependant on that when values are entered into range E:I.

I hope that made sense.

Thank you in advance for your help!

~ Geekamo
0
Comment
Question by:Geekamo
  • 2
  • 2
5 Comments
 
LVL 46

Expert Comment

by:Martin Liss
ID: 38776804
Are you familiar with Application.OnTime?
0
 
LVL 10

Accepted Solution

by:
tdlewis earned 500 total points
ID: 38776806
I'm assuming you have automatic calculations disabled. (Otherwise, the cell containing =NOW() should update every time there is a change on the sheet.)

Add this code to the worksheet:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column >= 5 And Target.Column <= 9 Then
        Application.Calculate
    End If
End Sub

Open in new window

0
 
LVL 1

Author Comment

by:Geekamo
ID: 38776808
@ MartinLiss

I assume that's something in the code section of excel, but no.  My skill level for excel, is someone who knows their way around a 'little' more then the average user who is forced to use excel.
0
 
LVL 1

Author Comment

by:Geekamo
ID: 38776817
@ tdlewis

Uh oh.  For some reason, I had it in my head that the value =NOW() returns, it's the value from right then.  And I assumed that it wouldn't change unless something happened, making it refresh.  I just checked, and updated that range 2 minutes later, and it did update to the current time.  So there was no need to even post this question.  lol

I'm sorry for wasting your time. :)

~ Geekamo
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 38776831
What I'm suggesting is the update the time at a specific interval rather than depending on a worksheet event.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now