PC Review


Reply
Thread Tools Rate Thread

Automatic Update Upon Opening of Spreadsheet

 
 
Sara
Guest
Posts: n/a
 
      25th Jun 2008
I have a cell containing a number that I need to increase by an increment of
one each time I open the document. Is there a formula I can write that will
automatically do this for me? I am relatively new to the more advanced
capabilities of Excel, though I have a basic understanding of Visual Basic;
do I need to create a Macro or can I use a simple formula on the spreadsheet?
Thank you.
 
Reply With Quote
 
 
 
 
Kevin B
Guest
Posts: n/a
 
      25th Jun 2008
Press Alt + F11 to open the Visual Basic Editor.
In the Project Explorer in the upper left, double-click the Thisworkbook
icon to open
the workbook module

In the module window drop down the list in the first combo-box below the
toolbars and select WORKBOOK, and then select OPEN in the combo-box to the
left.

Enter the following code, modifying the Sheet1 value to match the sheet that
will receive the update and the A1 reference to the cell that is to be
updated on open:


Dim ws As Worksheet
Dim l As Long

Set ws = ThisWorkbook.Sheets(1)

l = ws.Range("A1").Value
Range("A1").Value = l + 1
ActiveWorkbook.Save

Set ws = Nothing

Click FILE in the menu and select CLOSE AND RETURN TO EXCEL.

Save and close the workbook and reopen it to test drive.

If you don't want anyone to modify this value you might want to consider
protecting the worksheet.
--
Kevin Backmann


"Sara" wrote:

> I have a cell containing a number that I need to increase by an increment of
> one each time I open the document. Is there a formula I can write that will
> automatically do this for me? I am relatively new to the more advanced
> capabilities of Excel, though I have a basic understanding of Visual Basic;
> do I need to create a Macro or can I use a simple formula on the spreadsheet?
> Thank you.

 
Reply With Quote
 
Sara
Guest
Posts: n/a
 
      25th Jun 2008
Thank you so much! That was incredibly helpful.

"Kevin B" wrote:

> Press Alt + F11 to open the Visual Basic Editor.
> In the Project Explorer in the upper left, double-click the Thisworkbook
> icon to open
> the workbook module
>
> In the module window drop down the list in the first combo-box below the
> toolbars and select WORKBOOK, and then select OPEN in the combo-box to the
> left.
>
> Enter the following code, modifying the Sheet1 value to match the sheet that
> will receive the update and the A1 reference to the cell that is to be
> updated on open:
>
>
> Dim ws As Worksheet
> Dim l As Long
>
> Set ws = ThisWorkbook.Sheets(1)
>
> l = ws.Range("A1").Value
> Range("A1").Value = l + 1
> ActiveWorkbook.Save
>
> Set ws = Nothing
>
> Click FILE in the menu and select CLOSE AND RETURN TO EXCEL.
>
> Save and close the workbook and reopen it to test drive.
>
> If you don't want anyone to modify this value you might want to consider
> protecting the worksheet.
> --
> Kevin Backmann
>
>
> "Sara" wrote:
>
> > I have a cell containing a number that I need to increase by an increment of
> > one each time I open the document. Is there a formula I can write that will
> > automatically do this for me? I am relatively new to the more advanced
> > capabilities of Excel, though I have a basic understanding of Visual Basic;
> > do I need to create a Macro or can I use a simple formula on the spreadsheet?
> > Thank you.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: automatically update a link without opening the other spreadsheet =?Utf-8?B?QW5jaWVudCBCcml0?= Microsoft Excel Misc 0 8th May 2007 01:49 AM
RE: automatically update a link without opening the other spreadsheet =?Utf-8?B?Q21L?= Microsoft Excel Misc 0 24th Feb 2007 02:54 PM
Re: Automatic update of spreadsheet & automatic update between workboo Gord Dibben Microsoft Excel Worksheet Functions 0 7th Dec 2006 06:49 PM
Automatic update of information in a spreadsheet =?Utf-8?B?YW9sbzcyNzY=?= Microsoft Excel Misc 1 12th Apr 2005 02:39 PM
How to update a linked spreadsheet without opening it? kpax Microsoft Excel Misc 3 9th Apr 2004 03:40 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:19 PM.