Solved

Code To Update/Refresh Spreadsheet

Posted on 2013-01-14
5
274 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 45

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 45

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
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…

747 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

13 Experts available now in Live!

Get 1:1 Help Now