Solved

Code To Update/Refresh Spreadsheet

Posted on 2013-01-14
5
314 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 48

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 48

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

690 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