Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 349
Default Macro to create next number in sequence to be used on 2 workbooks

Hi all -

I have 2 workbooks (excel 2003) for tracking invoice numbers - which now run
alternate to each other - to avoid having to open both workbooks and having
to look at which was the last number used (to stop duplicate invoice number)
is it possible to create a simple macro that will look at both lists -
identifty last number used and then add 1 - putting this in the next
available cell. Hope this makes sense!

Simple layout of both workbooks:

Book 1 Book 2
A B A B
Date Invoice Number Date Invoice Number
1/10/08 12345 3/10/08 12346
6/10/08 ??? 5/10/08 12347
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Macro to create next number in sequence to be used on 2 workbooks

An alternative would be to store the last used number in the registry or
a text file. See

http://www.mcgimpsey.com/excel/udfs/sequentialnums.html



In article ,
Peter wrote:

Hi all -

I have 2 workbooks (excel 2003) for tracking invoice numbers - which now run
alternate to each other - to avoid having to open both workbooks and having
to look at which was the last number used (to stop duplicate invoice number)
is it possible to create a simple macro that will look at both lists -
identifty last number used and then add 1 - putting this in the next
available cell. Hope this makes sense!

Simple layout of both workbooks:

Book 1 Book 2
A B A B
Date Invoice Number Date Invoice Number
1/10/08 12345 3/10/08 12346
6/10/08 ??? 5/10/08 12347

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Macro to create next number in sequence to be used on 2 workbooks

Say Book1 and Book2 are in C:\test

In ANY workbook, the next available sequence number is one more than the max
in column B of Book1 and Book2:

=MAX(MAX(Sheet1!$B:$B),MAX('C:\test\[Book2.xls]Sheet1'!$B:$B))+1

Enter the formula OUTSIDE of column B in either ( or both) workbooks. Then
copy the cell and paste/special/value where you need it in column B
--
Gary''s Student - gsnu200810


"Peter" wrote:

Hi all -

I have 2 workbooks (excel 2003) for tracking invoice numbers - which now run
alternate to each other - to avoid having to open both workbooks and having
to look at which was the last number used (to stop duplicate invoice number)
is it possible to create a simple macro that will look at both lists -
identifty last number used and then add 1 - putting this in the next
available cell. Hope this makes sense!

Simple layout of both workbooks:

Book 1 Book 2
A B A B
Date Invoice Number Date Invoice Number
1/10/08 12345 3/10/08 12346
6/10/08 ??? 5/10/08 12347

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 349
Default Macro to create next number in sequence to be used on 2 workbo

Thanks JE,

Checked out the link - very informative :)

"JE McGimpsey" wrote:

An alternative would be to store the last used number in the registry or
a text file. See

http://www.mcgimpsey.com/excel/udfs/sequentialnums.html



In article ,
Peter wrote:

Hi all -

I have 2 workbooks (excel 2003) for tracking invoice numbers - which now run
alternate to each other - to avoid having to open both workbooks and having
to look at which was the last number used (to stop duplicate invoice number)
is it possible to create a simple macro that will look at both lists -
identifty last number used and then add 1 - putting this in the next
available cell. Hope this makes sense!

Simple layout of both workbooks:

Book 1 Book 2
A B A B
Date Invoice Number Date Invoice Number
1/10/08 12345 3/10/08 12346
6/10/08 ??? 5/10/08 12347


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 349
Default Macro to create next number in sequence to be used on 2 workbo

Hi Gary

Thanks for this - I was not sure if a formula would capture it, I will be
able to use this formula in a simple macro - so that the girls in the office
only have to click on macro button - should work a treat.

Thanks

"Gary''s Student" wrote:

Say Book1 and Book2 are in C:\test

In ANY workbook, the next available sequence number is one more than the max
in column B of Book1 and Book2:

=MAX(MAX(Sheet1!$B:$B),MAX('C:\test\[Book2.xls]Sheet1'!$B:$B))+1

Enter the formula OUTSIDE of column B in either ( or both) workbooks. Then
copy the cell and paste/special/value where you need it in column B
--
Gary''s Student - gsnu200810


"Peter" wrote:

Hi all -

I have 2 workbooks (excel 2003) for tracking invoice numbers - which now run
alternate to each other - to avoid having to open both workbooks and having
to look at which was the last number used (to stop duplicate invoice number)
is it possible to create a simple macro that will look at both lists -
identifty last number used and then add 1 - putting this in the next
available cell. Hope this makes sense!

Simple layout of both workbooks:

Book 1 Book 2
A B A B
Date Invoice Number Date Invoice Number
1/10/08 12345 3/10/08 12346
6/10/08 ??? 5/10/08 12347

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
Macro to create sequence of numbers [email protected] Excel Programming 1 February 22nd 08 06:33 PM
create a macro that compares two workbooks blopreste3180 Excel Discussion (Misc queries) 2 September 5th 07 05:26 PM
Macro to Create Workbooks & Worksheets Ciara Excel Programming 0 February 28th 07 01:22 PM
can't create excel add-in macro to use with other workbooks icccapital Excel Programming 1 February 21st 07 05:31 PM
Opening workbooks in sequence Matt Excel Programming 3 April 20th 04 06:57 PM


All times are GMT +1. The time now is 02:19 AM.

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"