#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default queries in excel

if we have a file in excel and there is a cell starting in number 1 and when
i want to close this sheet and reopen it again i wanna be 2 by auto ,so each
time i open this file i wanna this number to be increased automatically

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,316
Default queries in excel

Press Alt + F11 to open the VBE and then double click the ThisWorkbook object
in the project window.

In the Code pane change the value in the combo box on the left to Workbook
and the value in the combobox on the right to Open.

Enter the following line of code in the Workbook_Open() event


Sheets(1).Range("A1").Value = Sheets(1).Range("A1").Value + 1

Change the worksheet's index number to the reference the sheet you're
wanting to track the number of times the workbook is opened and the cell
address you want the total in. Sheets can also be referenced by their tab
name as follows.

Sheets("Sheet1").Range("A1").Value = Sheets("Sheet1").Range("A1").Value
+ 1



--
Kevin Backmann


"gaby elia" wrote:

if we have a file in excel and there is a cell starting in number 1 and when
i want to close this sheet and reopen it again i wanna be 2 by auto ,so each
time i open this file i wanna this number to be increased automatically

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default queries in excel

This will increment cell A1 in worksheet Sheet1:

Private Sub Workbook_Open()
With Sheets("Sheet1").Range("A1")
.Value = .Value + 1
End With
End Sub

This event macro goes in the workbook code area.
--
Gary''s Student - gsnu200789


"gaby elia" wrote:

if we have a file in excel and there is a cell starting in number 1 and when
i want to close this sheet and reopen it again i wanna be 2 by auto ,so each
time i open this file i wanna this number to be increased automatically

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel queries ah Excel Worksheet Functions 2 May 8th 08 02:23 PM
Excel 2007 queries summerLove Excel Discussion (Misc queries) 0 August 10th 07 02:36 PM
Excel web queries using parameters Rob Cherry Excel Discussion (Misc queries) 6 March 19th 07 01:33 AM
Excel Queries Anselmo Links and Linking in Excel 4 July 14th 06 11:45 PM
Web Queries Excel 97 Dave Excel Discussion (Misc queries) 0 June 16th 06 05:23 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"