Help!

Auto Numbering

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Excel General (archive) RSS
Next:  Coversion Of Fractions To Percentages  
Author Message
Excel Man
External


Since: Aug 02, 2005
Posts: 2



PostPosted: Tue Aug 02, 2005 7:58 am    Post subject: Auto Numbering
Archived from groups: microsoft>public>excel>misc (more info?)

I want my invoices to automatically go up in number. EX. Invoice 1, Invoice
2...
I want this to happen every time I open my template to create a new invoice.
I can't remember how to do this. Can anyone provide me with an answer?
Thanks
Back to top
FSt1
External


Since: Jun 26, 2005
Posts: 171



PostPosted: Tue Aug 02, 2005 8:40 am    Post subject: RE: Auto Numbering [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

hi,
I wrote this for someone a few months back. it was for pruchase Orders so
you may have to make a few changes but it will do the same for you.
Post back if you have problems.

Sub MacCreatePO()

'Creates a new PO(purchase order) workbook, saving the created PO workbook
with
'the PO number as part of the file name. Leaves the "template" PO workbook
"as is".
'macCreatePO should be triggered from a button on the PO Template sheet.

Dim n As Range
Set n = Range("A1") ' the all important PO number. change if needed
'to a place in the PO template.
Application.CutCopyMode = False 'clears the clipboard
Range("A1:L25").Select 'change to accommodate the size of the PO template
Selection.Copy
Workbooks.Add
Range("A1").PasteSpecial xlPasteAll
'change the file path to where you want to save the PO workbook
ActiveWorkbook.SaveAs Filename:="H:\CodeStuff\PO" & n & ".xls" _
FileFormat:= xlNormal, Password:="", WriteResPassword:="" _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.Close
Cells(1, 1).Select 'go and park at cell A1 and wait
MsgBox ("Purchase Order was saved as PO" & n & ".xls")
n.Value = n.Value + 1 'add 1 to old PO number for new PO number
'change the place of the date to add. Macro puts today's date
'in but this can be edited.
Range("I1") = Date
'clear the contents of the old PO to set up the next PO. clear
surgically so
'to leave template in tact. more clearContents commands may be needed.
'Range("need areas to clear here").ClearContents
ActiveWorkbook.Save 'save the cleared template workbook with new
'(next) POnumber.
'Ready for next PO
End Sub

regards

FSt1
"Excel Man" wrote:

> I want my invoices to automatically go up in number. EX. Invoice 1, Invoice
> 2...
> I want this to happen every time I open my template to create a new invoice.
> I can't remember how to do this. Can anyone provide me with an answer?
> Thanks
Back to top
Excel Man
External


Since: Aug 02, 2005
Posts: 2



PostPosted: Tue Aug 02, 2005 9:04 am    Post subject: RE: Auto Numbering [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

THANKS, WORKS GREAT

"FSt1" wrote:

> hi,
> I wrote this for someone a few months back. it was for pruchase Orders so
> you may have to make a few changes but it will do the same for you.
> Post back if you have problems.
>
> Sub MacCreatePO()
>
> 'Creates a new PO(purchase order) workbook, saving the created PO workbook
> with
> 'the PO number as part of the file name. Leaves the "template" PO workbook
> "as is".
> 'macCreatePO should be triggered from a button on the PO Template sheet.
>
> Dim n As Range
> Set n = Range("A1") ' the all important PO number. change if needed
> 'to a place in the PO template.
> Application.CutCopyMode = False 'clears the clipboard
> Range("A1:L25").Select 'change to accommodate the size of the PO template
> Selection.Copy
> Workbooks.Add
> Range("A1").PasteSpecial xlPasteAll
> 'change the file path to where you want to save the PO workbook
> ActiveWorkbook.SaveAs Filename:="H:\CodeStuff\PO" & n & ".xls" _
> FileFormat:= xlNormal, Password:="", WriteResPassword:="" _
> ReadOnlyRecommended:=False, CreateBackup:=False
> ActiveWorkbook.Close
> Cells(1, 1).Select 'go and park at cell A1 and wait
> MsgBox ("Purchase Order was saved as PO" & n & ".xls")
> n.Value = n.Value + 1 'add 1 to old PO number for new PO number
> 'change the place of the date to add. Macro puts today's date
> 'in but this can be edited.
> Range("I1") = Date
> 'clear the contents of the old PO to set up the next PO. clear
> surgically so
> 'to leave template in tact. more clearContents commands may be needed.
> 'Range("need areas to clear here").ClearContents
> ActiveWorkbook.Save 'save the cleared template workbook with new
> '(next) POnumber.
> 'Ready for next PO
> End Sub
>
> regards
>
> FSt1
> "Excel Man" wrote:
>
> > I want my invoices to automatically go up in number. EX. Invoice 1, Invoice
> > 2...
> > I want this to happen every time I open my template to create a new invoice.
> > I can't remember how to do this. Can anyone provide me with an answer?
> > Thanks
Back to top
chris w
External


Since: Jan 13, 2005
Posts: 9



PostPosted: Tue Aug 02, 2005 11:45 am    Post subject: RE: Auto Numbering [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

This sound exactly what I need. How can I use the code? I am getting syntax
errors on the copy and paste. Unfortunatly I have done limited code writing,
mostly creating macros, so Im slow.

"FSt1" wrote:

> hi,
> I wrote this for someone a few months back. it was for pruchase Orders so
> you may have to make a few changes but it will do the same for you.
> Post back if you have problems.
>
> Sub MacCreatePO()
>
> 'Creates a new PO(purchase order) workbook, saving the created PO workbook
> with
> 'the PO number as part of the file name. Leaves the "template" PO workbook
> "as is".
> 'macCreatePO should be triggered from a button on the PO Template sheet.
>
> Dim n As Range
> Set n = Range("A1") ' the all important PO number. change if needed
> 'to a place in the PO template.
> Application.CutCopyMode = False 'clears the clipboard
> Range("A1:L25").Select 'change to accommodate the size of the PO template
> Selection.Copy
> Workbooks.Add
> Range("A1").PasteSpecial xlPasteAll
> 'change the file path to where you want to save the PO workbook
> ActiveWorkbook.SaveAs Filename:="H:\CodeStuff\PO" & n & ".xls" _
> FileFormat:= xlNormal, Password:="", WriteResPassword:="" _
> ReadOnlyRecommended:=False, CreateBackup:=False
> ActiveWorkbook.Close
> Cells(1, 1).Select 'go and park at cell A1 and wait
> MsgBox ("Purchase Order was saved as PO" & n & ".xls")
> n.Value = n.Value + 1 'add 1 to old PO number for new PO number
> 'change the place of the date to add. Macro puts today's date
> 'in but this can be edited.
> Range("I1") = Date
> 'clear the contents of the old PO to set up the next PO. clear
> surgically so
> 'to leave template in tact. more clearContents commands may be needed.
> 'Range("need areas to clear here").ClearContents
> ActiveWorkbook.Save 'save the cleared template workbook with new
> '(next) POnumber.
> 'Ready for next PO
> End Sub
>
> regards
>
> FSt1
> "Excel Man" wrote:
>
> > I want my invoices to automatically go up in number. EX. Invoice 1, Invoice
> > 2...
> > I want this to happen every time I open my template to create a new invoice.
> > I can't remember how to do this. Can anyone provide me with an answer?
> > Thanks
Back to top
FSt1
External


Since: Jun 26, 2005
Posts: 171



PostPosted: Tue Aug 02, 2005 12:26 pm    Post subject: RE: Auto Numbering [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

hi,
you shouldn't be having errors if you made all the changes.
did you?

regards
FSt1

"chris w" wrote:

> This sound exactly what I need. How can I use the code? I am getting syntax
> errors on the copy and paste. Unfortunatly I have done limited code writing,
> mostly creating macros, so Im slow.
>
> "FSt1" wrote:
>
> > hi,
> > I wrote this for someone a few months back. it was for pruchase Orders so
> > you may have to make a few changes but it will do the same for you.
> > Post back if you have problems.
> >
> > Sub MacCreatePO()
> >
> > 'Creates a new PO(purchase order) workbook, saving the created PO workbook
> > with
> > 'the PO number as part of the file name. Leaves the "template" PO workbook
> > "as is".
> > 'macCreatePO should be triggered from a button on the PO Template sheet.
> >
> > Dim n As Range
> > Set n = Range("A1") ' the all important PO number. change if needed
> > 'to a place in the PO template.
> > Application.CutCopyMode = False 'clears the clipboard
> > Range("A1:L25").Select 'change to accommodate the size of the PO template
> > Selection.Copy
> > Workbooks.Add
> > Range("A1").PasteSpecial xlPasteAll
> > 'change the file path to where you want to save the PO workbook
> > ActiveWorkbook.SaveAs Filename:="H:\CodeStuff\PO" & n & ".xls" _
> > FileFormat:= xlNormal, Password:="", WriteResPassword:="" _
> > ReadOnlyRecommended:=False, CreateBackup:=False
> > ActiveWorkbook.Close
> > Cells(1, 1).Select 'go and park at cell A1 and wait
> > MsgBox ("Purchase Order was saved as PO" & n & ".xls")
> > n.Value = n.Value + 1 'add 1 to old PO number for new PO number
> > 'change the place of the date to add. Macro puts today's date
> > 'in but this can be edited.
> > Range("I1") = Date
> > 'clear the contents of the old PO to set up the next PO. clear
> > surgically so
> > 'to leave template in tact. more clearContents commands may be needed.
> > 'Range("need areas to clear here").ClearContents
> > ActiveWorkbook.Save 'save the cleared template workbook with new
> > '(next) POnumber.
> > 'Ready for next PO
> > End Sub
> >
> > regards
> >
> > FSt1
> > "Excel Man" wrote:
> >
> > > I want my invoices to automatically go up in number. EX. Invoice 1, Invoice
> > > 2...
> > > I want this to happen every time I open my template to create a new invoice.
> > > I can't remember how to do this. Can anyone provide me with an answer?
> > > Thanks
Back to top
chris w
External


Since: Jan 13, 2005
Posts: 9



PostPosted: Tue Aug 02, 2005 1:20 pm    Post subject: RE: Auto Numbering [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I made the change to the line to show

ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\Owner\My
Documents\PO" & n &".xls"_

where am I wrong? should the & n & be replaced with somthing?

"FSt1" wrote:

> hi,
> you shouldn't be having errors if you made all the changes.
> did you?
>
> regards
> FSt1
>
> "chris w" wrote:
>
> > This sound exactly what I need. How can I use the code? I am getting syntax
> > errors on the copy and paste. Unfortunatly I have done limited code writing,
> > mostly creating macros, so Im slow.
> >
> > "FSt1" wrote:
> >
> > > hi,
> > > I wrote this for someone a few months back. it was for pruchase Orders so
> > > you may have to make a few changes but it will do the same for you.
> > > Post back if you have problems.
> > >
> > > Sub MacCreatePO()
> > >
> > > 'Creates a new PO(purchase order) workbook, saving the created PO workbook
> > > with
> > > 'the PO number as part of the file name. Leaves the "template" PO workbook
> > > "as is".
> > > 'macCreatePO should be triggered from a button on the PO Template sheet.
> > >
> > > Dim n As Range
> > > Set n = Range("A1") ' the all important PO number. change if needed
> > > 'to a place in the PO template.
> > > Application.CutCopyMode = False 'clears the clipboard
> > > Range("A1:L25").Select 'change to accommodate the size of the PO template
> > > Selection.Copy
> > > Workbooks.Add
> > > Range("A1").PasteSpecial xlPasteAll
> > > 'change the file path to where you want to save the PO workbook
> > > ActiveWorkbook.SaveAs Filename:="H:\CodeStuff\PO" & n & ".xls" _
> > > FileFormat:= xlNormal, Password:="", WriteResPassword:="" _
> > > ReadOnlyRecommended:=False, CreateBackup:=False
> > > ActiveWorkbook.Close
> > > Cells(1, 1).Select 'go and park at cell A1 and wait
> > > MsgBox ("Purchase Order was saved as PO" & n & ".xls")
> > > n.Value = n.Value + 1 'add 1 to old PO number for new PO number
> > > 'change the place of the date to add. Macro puts today's date
> > > 'in but this can be edited.
> > > Range("I1") = Date
> > > 'clear the contents of the old PO to set up the next PO. clear
> > > surgically so
> > > 'to leave template in tact. more clearContents commands may be needed.
> > > 'Range("need areas to clear here").ClearContents
> > > ActiveWorkbook.Save 'save the cleared template workbook with new
> > > '(next) POnumber.
> > > 'Ready for next PO
> > > End Sub
> > >
> > > regards
> > >
> > > FSt1
> > > "Excel Man" wrote:
> > >
> > > > I want my invoices to automatically go up in number. EX. Invoice 1, Invoice
> > > > 2...
> > > > I want this to happen every time I open my template to create a new invoice.
> > > > I can't remember how to do this. Can anyone provide me with an answer?
> > > > Thanks
Back to top
Ken
External


Since: Sep 05, 2004
Posts: 347



PostPosted: Wed Jul 26, 2006 10:22 am    Post subject: RE: Auto Numbering [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Where do I start with the
MacCreatePO() command?


"FSt1" wrote:

> hi,
> I wrote this for someone a few months back. it was for pruchase Orders so
> you may have to make a few changes but it will do the same for you.
> Post back if you have problems.
>
> Sub MacCreatePO()
>
> 'Creates a new PO(purchase order) workbook, saving the created PO workbook
> with
> 'the PO number as part of the file name. Leaves the "template" PO workbook
> "as is".
> 'macCreatePO should be triggered from a button on the PO Template sheet.
>
> Dim n As Range
> Set n = Range("A1") ' the all important PO number. change if needed
> 'to a place in the PO template.
> Application.CutCopyMode = False 'clears the clipboard
> Range("A1:L25").Select 'change to accommodate the size of the PO template
> Selection.Copy
> Workbooks.Add
> Range("A1").PasteSpecial xlPasteAll
> 'change the file path to where you want to save the PO workbook
> ActiveWorkbook.SaveAs Filename:="H:\CodeStuff\PO" & n & ".xls" _
> FileFormat:= xlNormal, Password:="", WriteResPassword:="" _
> ReadOnlyRecommended:=False, CreateBackup:=False
> ActiveWorkbook.Close
> Cells(1, 1).Select 'go and park at cell A1 and wait
> MsgBox ("Purchase Order was saved as PO" & n & ".xls")
> n.Value = n.Value + 1 'add 1 to old PO number for new PO number
> 'change the place of the date to add. Macro puts today's date
> 'in but this can be edited.
> Range("I1") = Date
> 'clear the contents of the old PO to set up the next PO. clear
> surgically so
> 'to leave template in tact. more clearContents commands may be needed.
> 'Range("need areas to clear here").ClearContents
> ActiveWorkbook.Save 'save the cleared template workbook with new
> '(next) POnumber.
> 'Ready for next PO
> End Sub
>
> regards
>
> FSt1
> "Excel Man" wrote:
>
> > I want my invoices to automatically go up in number. EX. Invoice 1, Invoice
> > 2...
> > I want this to happen every time I open my template to create a new invoice.
> > I can't remember how to do this. Can anyone provide me with an answer?
> > Thanks
Back to top
Copi J
External


Since: Aug 24, 2006
Posts: 1



PostPosted: Thu Aug 24, 2006 6:50 am    Post subject: RE: Auto Numbering [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I have an Excel file that was created by someone else to address rejection
tags and I need to auto number in cell M2, i.e. Rejection Tag Number. Is this
possible?

"Ken" wrote:

> Where do I start with the
> MacCreatePO() command?
>
>
> "FSt1" wrote:
>
> > hi,
> > I wrote this for someone a few months back. it was for pruchase Orders so
> > you may have to make a few changes but it will do the same for you.
> > Post back if you have problems.
> >
> > Sub MacCreatePO()
> >
> > 'Creates a new PO(purchase order) workbook, saving the created PO workbook
> > with
> > 'the PO number as part of the file name. Leaves the "template" PO workbook
> > "as is".
> > 'macCreatePO should be triggered from a button on the PO Template sheet.
> >
> > Dim n As Range
> > Set n = Range("A1") ' the all important PO number. change if needed
> > 'to a place in the PO template.
> > Application.CutCopyMode = False 'clears the clipboard
> > Range("A1:L25").Select 'change to accommodate the size of the PO template
> > Selection.Copy
> > Workbooks.Add
> > Range("A1").PasteSpecial xlPasteAll
> > 'change the file path to where you want to save the PO workbook
> > ActiveWorkbook.SaveAs Filename:="H:\CodeStuff\PO" & n & ".xls" _
> > FileFormat:= xlNormal, Password:="", WriteResPassword:="" _
> > ReadOnlyRecommended:=False, CreateBackup:=False
> > ActiveWorkbook.Close
> > Cells(1, 1).Select 'go and park at cell A1 and wait
> > MsgBox ("Purchase Order was saved as PO" & n & ".xls")
> > n.Value = n.Value + 1 'add 1 to old PO number for new PO number
> > 'change the place of the date to add. Macro puts today's date
> > 'in but this can be edited.
> > Range("I1") = Date
> > 'clear the contents of the old PO to set up the next PO. clear
> > surgically so
> > 'to leave template in tact. more clearContents commands may be needed.
> > 'Range("need areas to clear here").ClearContents
> > ActiveWorkbook.Save 'save the cleared template workbook with new
> > '(next) POnumber.
> > 'Ready for next PO
> > End Sub
> >
> > regards
> >
> > FSt1
> > "Excel Man" wrote:
> >
> > > I want my invoices to automatically go up in number. EX. Invoice 1, Invoice
> > > 2...
> > > I want this to happen every time I open my template to create a new invoice.
> > > I can't remember how to do this. Can anyone provide me with an answer?
> > > Thanks
Back to top
Douglas
External


Since: Mar 17, 2006
Posts: 19



PostPosted: Tue Dec 19, 2006 5:11 am    Post subject: RE: Auto Numbering [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Your problem seems similar to mine - hope youcan help.
By default the number I type in a cell should stay the same once I enter it
- e.g.
when I type in 19 and press Enter the figure in the cell should still read 19.
However it changes to 0.19. Do you know how to rectify this problem/
Douglas
"FSt1" wrote:

> hi,
> you shouldn't be having errors if you made all the changes.
> did you?
>
> regards
> FSt1
>
> "chris w" wrote:
>
> > This sound exactly what I need. How can I use the code? I am getting syntax
> > errors on the copy and paste. Unfortunatly I have done limited code writing,
> > mostly creating macros, so Im slow.
> >
> > "FSt1" wrote:
> >
> > > hi,
> > > I wrote this for someone a few months back. it was for pruchase Orders so
> > > you may have to make a few changes but it will do the same for you.
> > > Post back if you have problems.
> > >
> > > Sub MacCreatePO()
> > >
> > > 'Creates a new PO(purchase order) workbook, saving the created PO workbook
> > > with
> > > 'the PO number as part of the file name. Leaves the "template" PO workbook
> > > "as is".
> > > 'macCreatePO should be triggered from a button on the PO Template sheet.
> > >
> > > Dim n As Range
> > > Set n = Range("A1") ' the all important PO number. change if needed
> > > 'to a place in the PO template.
> > > Application.CutCopyMode = False 'clears the clipboard
> > > Range("A1:L25").Select 'change to accommodate the size of the PO template
> > > Selection.Copy
> > > Workbooks.Add
> > > Range("A1").PasteSpecial xlPasteAll
> > > 'change the file path to where you want to save the PO workbook
> > > ActiveWorkbook.SaveAs Filename:="H:\CodeStuff\PO" & n & ".xls" _
> > > FileFormat:= xlNormal, Password:="", WriteResPassword:="" _
> > > ReadOnlyRecommended:=False, CreateBackup:=False
> > > ActiveWorkbook.Close
> > > Cells(1, 1).Select 'go and park at cell A1 and wait
> > > MsgBox ("Purchase Order was saved as PO" & n & ".xls")
> > > n.Value = n.Value + 1 'add 1 to old PO number for new PO number
> > > 'change the place of the date to add. Macro puts today's date
> > > 'in but this can be edited.
> > > Range("I1") = Date
> > > 'clear the contents of the old PO to set up the next PO. clear
> > > surgically so
> > > 'to leave template in tact. more clearContents commands may be needed.
> > > 'Range("need areas to clear here").ClearContents
> > > ActiveWorkbook.Save 'save the cleared template workbook with new
> > > '(next) POnumber.
> > > 'Ready for next PO
> > > End Sub
> > >
> > > regards
> > >
> > > FSt1
> > > "Excel Man" wrote:
> > >
> > > > I want my invoices to automatically go up in number. EX. Invoice 1, Invoice
> > > > 2...
> > > > I want this to happen every time I open my template to create a new invoice.
> > > > I can't remember how to do this. Can anyone provide me with an answer?
> > > > Thanks
Back to top
David Biddulph
External


Since: Dec 04, 2006
Posts: 569



PostPosted: Tue Dec 19, 2006 3:39 pm    Post subject: Re: Auto Numbering [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Tools/ Options/ Edit
Uncheck: Fixed Decimal Places
--
David Biddulph

"Douglas" <Douglas.RemoveThis@discussions.microsoft.com> wrote in message
news:D5700B6C-F6D6-4369-ACC5-E0B43311426F@microsoft.com...
> ...
> By default the number I type in a cell should stay the same once I enter
> it
> - e.g.
> when I type in 19 and press Enter the figure in the cell should still read
> 19.
> However it changes to 0.19. Do you know how to rectify this problem/
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Excel General (archive) All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum