Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 90
Default Formula to add a number

Can someone give me a formula so that I can have a number added automatically
to a cell each time I open a report.

The number is 10-200-1 and each time I open the report I want it to
automatically populate the fiield with the next number 10-200-2, 10-200-3 and
so on.

Thanks in advavnce for your help,
Deborah
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Formula to add a number

When you say open a report I have assumed you mean open a workbook if so try
this

Private Sub Workbook_Open()
Sheets("Sheet1").Select 'Change to suit
oldnum = Left(Range("A1").Value, 7)
x = 1 + Val(Right(Range("A1").Value, Len(Range("A1").Value) - 7))
Range("A1").Value = oldnum & x
End Sub


Mike

"Debbie" wrote:

Can someone give me a formula so that I can have a number added automatically
to a cell each time I open a report.

The number is 10-200-1 and each time I open the report I want it to
automatically populate the fiield with the next number 10-200-2, 10-200-3 and
so on.

Thanks in advavnce for your help,
Deborah

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Formula to add a number

By "open the report" , do you mean open the workbook? If so, and assuming
that the number is in Sheet1!A1 do the following.

1. Enter the initial number in the cell as a number value (no dashes) and
give it a custom format of "00-000-00".

2. Then put this code in the ThisWorkbook code module:

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


--
Hope that helps.

Vergel Adriano


"Debbie" wrote:

Can someone give me a formula so that I can have a number added automatically
to a cell each time I open a report.

The number is 10-200-1 and each time I open the report I want it to
automatically populate the fiield with the next number 10-200-2, 10-200-3 and
so on.

Thanks in advavnce for your help,
Deborah

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
Formula to convert a number with spaces to just a number? WolfgangPD Excel Discussion (Misc queries) 10 December 16th 08 03:21 AM
formula to throw out high number and low number Deb Excel Worksheet Functions 8 September 16th 07 06:51 AM
Creating number formula to count number occurences in a data set Brreese24 Excel Programming 1 August 23rd 07 11:18 PM
Formula to change scientific number to regular number or text Compare Values Excel Discussion (Misc queries) 2 August 23rd 07 06:10 PM
countif formula to find the occurances of a number that is greater than one number but less than another steveo Excel Discussion (Misc queries) 3 July 8th 06 02:04 AM


All times are GMT +1. The time now is 12:25 AM.

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

About Us

"It's about Microsoft Excel"