Controlling Sequential Numbers

I have been researching using sequential numbers for invoices an
purchase orders, but all of them seem to advance the number eithe
every time the document is opened or saved.  My purchase order is par
of a larger file, and since I will be opening and saving the fil
without necessarily writing a purchase order I need more control ove
its advancement.  I was wondering how I could create a button that whe
pressed or selected would advance the number by 1?    Also, how could 
make it create a unique number depending on who's creating the purchas
order.  For example, let's say the user is "John Smith" how could I hav
the P.O. number be somthing like "JS-0001"?  Thank you very much i
advance for your help

--
littlegreenmen
-----------------------------------------------------------------------
littlegreenmen1's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2397
View this thread: http://www.excelforum.com/showthread.php?threadid=37647

0
6/4/2005 2:17:47 AM
excel.misc 78881 articles. 5 followers. Follow

2 Replies
688 Views

Similar Articles

[PageSpeed] 27

You could easily create a button from the control toolbox (go to view > 
toolbars) on your sheet. Right-click the button, go to View Code, and paste 
this into the window:

Private Sub CommandButton1_Click()

Dim strName As String 'name entered
Dim nSpacePos As Long 'position of space in name
Dim rngPOCell As Range 'location of PO number
Dim strNameIni As String 'name initials
Dim strNewPO As String 'new PO number
Dim strCurrPONum As String 'current PO number
Dim strInputMsg As String 'message to user

Set rngPOCell = ActiveSheet.[A1]  'Change to target cell

strInputMsg = "Enter your first and last name. " & Chr(10) & _
"Make sure to include a space between the names. " & Chr(10) & _
"If you have multiple first names and/or last " & Chr(10) & _
"names, use the first word only. For example, " & Chr(10) & _
"Mary Kate Van Gretten would be Mary Van."

strName = InputBox(strInputMsg)
If strName = "" Then Exit Sub
If Len(strName) < 3 Then
    MsgBox "Invalid Name."
    Exit Sub
ElseIf IsError(Application.Find(" ", strName)) Then
    MsgBox "Invalid Name."
    Exit Sub
End If

nSpacePos = InStr(strName, " ")
strNameIni = UCase(Left(strName, 1)) & _
UCase(Mid(strName, nSpacePos + 1, 1))

With rngPOCell
    If .Value = "" Then
        .Value = strNameIni & "-0001"
    Else
        strCurrPONum = Format(Right(.Value, 4) + 1, "0000")
        .Value = strNameIni & "-" & strCurrPONum
    End If
End With

End Sub

---
This will place a new PO # in A1.

HTH
Jason
Atlanta, GA


"littlegreenmen1" wrote:

> 
> I have been researching using sequential numbers for invoices and
> purchase orders, but all of them seem to advance the number either
> every time the document is opened or saved.  My purchase order is part
> of a larger file, and since I will be opening and saving the file
> without necessarily writing a purchase order I need more control over
> its advancement.  I was wondering how I could create a button that when
> pressed or selected would advance the number by 1?    Also, how could I
> make it create a unique number depending on who's creating the purchase
> order.  For example, let's say the user is "John Smith" how could I have
> the P.O. number be somthing like "JS-0001"?  Thank you very much in
> advance for your help.
> 
> 
> -- 
> littlegreenmen1
> ------------------------------------------------------------------------
> littlegreenmen1's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=23978
> View this thread: http://www.excelforum.com/showthread.php?threadid=376479
> 
> 
0
jasonjmorin (551)
6/4/2005 5:01:02 AM
Thank you so much.  That worked perfectly.  I really appreciate it

--
littlegreenmen
-----------------------------------------------------------------------
littlegreenmen1's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2397
View this thread: http://www.excelforum.com/showthread.php?threadid=37647

0
6/4/2005 4:24:39 PM
Reply:

Similar Artilces:

bound control or inbound control
Hi Katherine, There are differences between using bound versus unbound controls. Where on the form do you want to use an unbound control? Jeanette Cunningham "Katherine" <Katherine@discussions.microsoft.com> wrote in message news:23BBC192-0A74-4B9F-9513-5E5923A76658@microsoft.com... > ...

why won't word 2007 release control of a .rtf file after exiting w
I AM HAVING TROUBLE WITH ACCESS TO RICH TEXT FILES BY PROGRAMS OTHER THAN WORD------ AFTER THE FILE OPEN IN WORD IS CLOSED AND EVEN AFTER WORD HAS BEEN SHUT DOWN (EXITED) ---------- I GET THE ERROR MESSAGE THAT THE FILE IS "IN USE" BY WORD WHEN (FOR EXAMPLE) AN ATTEMPT IS MADE TO DELETE IT ---- SOMETIMES WHEN RE-OPENING THE FILE AFTER RE-STARTING WORD THE FILE CANNOT BE SAVED BECAUSE IT IS IN "READ ONLY" MODE ------- AFTER MUCH FIDDLING AROUND I FINALLY MANAGED TO DELETE THE PROBLEM FILE ONLY TO HAVE THE SAME PROBLEM RETURN WITH A DIFFERNT FILE ----- WORD 200...

RE: Control
Can some one point me right direction to achive this following. Need to dispaly a data in a table format. some of the column data may have to display a image/icon based on a value from the table (1 :- Red color icon, 2:-yellow color icon...) Once the data is loaded and displayed on the format , able to search particular row by column index and update the values including the images(change different image). I tried with Listview control, with the report view I am not able to search row and update the columns with the List vew I am not able to show the image/icon. do not want to use ...

PUBLISHER
Please use this space to ask you question. And make sure you give us all of the information you can, especially which version of Publisher you are using. -- JoAnn Paules MVP Microsoft [Publisher] "Murrayjones" <Murrayjones@discussions.microsoft.com> wrote in message news:05C80DBE-0FF2-455E-93A9-5EE35E2F8D36@microsoft.com... > I am using Publisher 2000 and trying to insert numbering into a document with 10 tickets. Can you help? "JoAnn Paules [MSFT MVP]" wrote: > Please use this space to ask you question. And make sure you give us all of > ...

MSCRM login and the Users Control Panel
Is anyone aware of any way that the settings stored under Control Panel - Users - Password Management might interfere with the process of Single Sign On into MSCRM? It seemed to have somehow cached someones login and prevented logging in as the logged in user, until cached credentials had been "deleted". However I have never seen this mentioned as being relevant. I am not too sure what the architecture model is there, but it appears to be a single domain. If this area has any relevance, it would be useful to know....thanks ...

Spam control - MS Outlook
Hi! I am using MS Outlook 2000 and use 2 profiles. I recently installed a firewall package (Fsecure = Telia S�ker Surf), including Spam control. After install, MSO hangs and I cannot change to the other profile (if I not removed MSO by ctrl/alt/del) Somebody want to comment this? /Sven-Erik Intergrated AV/Spam is the cause of frequent issues in Outlook Is the FSecure you installed compatible with this old version of Outlook? "Storfille" <storfille@ebrev.net> wrote in message news:b1Ixm.11987$U5.164765@newsb.telia.net... > Hi! > > I am using MS Outlook 200...

Releasing memory after creating OCX control
Hi, I try to create an instance of an activex control in my MFC dialog based app. Though my application works with out any error, if i check the memory after calling "delete pMyControl" it keeps on occupying the same memory it occupied when the control was alive. Could anyone help me where I am missing to clear the memory? Thank you. My Code here ---------------m_pxWmp= new CWMPPlayer4();if( m_pxWmp->Create("replay", WS_CHILD | WS_BORDER | WS_VISIBLE , CRect(100, 100,320,240), this, 2)){ m_replay = true; m_pxWmp->SetUrl("C:\\video.avi"); m_pxWmp->Set...

numbering macro
In a database of say 10 columns and 100 rows, how do I record a macro that will o Insert a new column to the left of column A, then o in the new column A, number the rows that contain data in column B. Note: The numbering should start from 1. Since row 1 has the database heading & row 2 has the column headings, the numbering (no. 1) should start from row 3 and continue down to the last row that has data in column B. Columns("A:A").Insert For i = 1 to 100 If Cells(i,"B").Value <> "" Then Cells(i,"A&q...

Adding a control variable
Hello all, Under VC++ 7.1, I've added a checkbox to a dialog. Using the dialog editor, I am not trying to add a control variable for this check box. However, when I right-click on the check box and select "Add Variable", the resulting wizard dialog does not allow me to select "Control Variable" (it is grayed out). What do I need to do to get a control variable for this check box added to my class? Thanks, Dave I've never seen that before - are you able to duplicate this problem with other projects too? -- Regards, Nish [VC++ MVP] "Dave" <bett...

xcel Number Formatting Problem
Hi there, I have exported accounting information from a company data website int excel. For some reason, where profit figures had a 1000 seperator (, on the website, when exported into excel the 1000 seperator became decimal point (.). Also, the profit figures taken from the website ar in GDP th i.e. excluding the last '000'. Therefore, please can you help me do the following: 1) Replace the unwanted decimal point (.) back to a 1000 seperato (,). 2) Add 000 to the end of the profit figures so that they are in writte in full. Many thanks And -- andyp16 ------------------------...

what control can display characters from txt files in a dialog?
I want to read lines from txt files and display them on a dialog.I wonder which control can be put into the dialog to hold the characters from txt? Something like :- while(m_file.ReadString(tmpstr)) { str += tmpstr; } m_edit.SetWindowText(str); -- Regards, Nish [VC++ MVP] "liao_xf" <sclxf@sina.com> wrote in message news:001401c3652f$177b9830$a001280a@phx.gbl... > Thanks first! > I know that Edit control can receive and edit input. > and I know the filestdio can read lines from txt. > but can you tell me how to attatch the lines to the edit? > Thanks!...

stock control system
trying to see up a 'basic stock control sytem' for a warehouse that contains building materials. -- Thank you. You can use multiple ways of doing, there's 3 ways to come to m head... 1) Use a worksheet as database an save all the information on the cell of that worksheet using some macros to access it and handle. 2) You might want to use Access instead of Excel, I think would b easier to handle the database portion and you still have the Macro available. 3) You can use VB with an Access to create an application -- fanay ------------------------------------------------------...

Getting the number of processors
What's the best way to get the number of processors? I was thinking of just getting it from the environment variable. -- Thanks. "Saucer Man" <saucerman@nospam.net> wrote in message news:uLnKelwiKHA.1572@TK2MSFTNGP04.phx.gbl... > What's the best way to get the number of processors? I was thinking of > just getting it from the environment variable. If WMI is an option then this may be a start: Sub main() MsgBox "Count processors=" & CountProcessors & vbCrLf & _ "Query processors=" & QueryProcessor...

Transation sequence number issue
Happy new year everybody!! I have a customer with this situation. his invoice must be sequentially he can't skip a transaction number for his invoices, when a transaction is aborted a number is skiped. i konw that one is not hard to fix but this is the main issue when he do a return he need to have a differnt count numbers than the transactions number for example when he sale something the transation number 1545 is generated but is he return or do a store credit the transaction number is 145 without affectin the secuence os the sale transaction number. can be done? the other probl...

Creating dialog controls at run-time
I've been researching how to do this, but whenever I try what other people do, I get very bad results. But my challenge doesn't end there. The number of controls I want to create is only known at run-time. The problems I face are manifold: 1. The code most people use fails badly. Not only is the font unconventionally big, but when I click the checkbox I create, the whole dialog disappears. If that's not enough, the pointer to the control is NULL when the dialog's destructor is called, so I can't delete the instance, and get a memory leak message when the program ends: CADi...

Numbered List
New user of Outlook 2007 and recently created an email that had a numbered list that was quite long. It went to 17 items, and was left aligned. Is there anyway to change that to right aligned, short of using Word as the email editor. Thanks Carl well, you are using word as the editor in 2007.... Did you try selecting one of the items (or all) then clicking the little down arrow on the number list button and making a new numbered format? -- Diane Poremsky [MVP - Outlook] Need Help with Common Tasks? http://www.outlook-tips.net/beginner/ Outlook 2007: http://www.slipstick.com/outlook/ol2...

MDI support in ATL composite control
Hi, I have components created in ATL. The components are ATL composite controls. Entire work has been done till now using ATL, however I now need to give MDI type of work area (based o doc-view architecture) within the control. I have class derived from CMDIFrameWnd. However when I try to initialize instance of this class by calling "Create" method of CFrameWnd (base class in CMDIFrameWnd), I get error and creation fails. Tracing the code, I found that base class create method calls "AfxGetInstanceHandle" to get handle to the DLL. Now since this is ATL Composite control, ...

View Filtering and Access Controls for Business Units
I am trying to implement MS-CRM for my company. We have multiple Business Units . I need to give views to each Business Units so that they see only their own Contacts/Accounts/Opp lists. How do I accomplish this ? Also, If I gave inter business unit acesses , how do I make sure that the one business unit users can not modify any fields on other's Business Unit's records ? Thanks in advance for any help, Kishore This is quite easy to do with CRM. Assuming you have already created your Business Units in CRM, you can view a security role within one of the Business Units and a...

Tab Control Problems
I previously worked in VC++ 6.0, and have several applications that have either custom shadebox controls, or tab controls or group boxes. In all cases, when I moved the applications over to VS.NET 2003, everything was fine, except in the resource editor, I cannot see any of the controls that have been overlayed on a tab control, or a custom shadebox control and in some cases group boxes. I can tab to them and see the outline, but I cannot see the actual controls. If I drag a new control onto the tab control, I can see the control, but once it is saved, I can no longer access the cont...

Safe List...it there a limit to the number of sites that your can list
Is there a numerical limit to the number of email addresses and/or domains that you can list on the "safe list"???? Safe List...it there a limit to the number of sites that your can list Do you have a lot and do you think you hit a limit? If there is one, we don't know what it is yet... -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Coauthor, OneNote 2003 for Windows (Visual QuickStart Guide) Outlook Tips: http://www.outlook-tips.net/ Search for answers: http://groups.google.com Most recent posts to the Outlook newsgroups: http://group...

FindRecord Control Button
i built a find record control button so a user can type in the form number and go there but it only searches the field that the cursor is in and the form # is not on the tab order(purposely). How can i specify where the find record function searches? thanks Ryan, usually people use an unbound combo box or an unbound text box for searching. There is a sample download with code of a search form at http://www.allenbrowne.com/ser-62.html If you need help to get it working, post back. You can also use the wizard to put a combo for searching on your form. On the form in design view, click the...

Controls coordinates
Hi everyone, Could somebody give me a simple example of getting a controls coordinates and then using them to put the control back where it was. So basicaly the control hasn't moved. Here's what I'm doing: m_cQuality.GetWindowRect(&qualityRC); ClientToScreen(&qualityRC); // int temp=qualityRC.Height(); // qualityRC.top=unyteRC.bottom-temp; // qualityRC.right=qualityRC.Width(); // qualityRC.left=0; // qualityRC.bottom=qualityRC.top+temp; // m_cQuality.MoveWindow(&qualityRC); m_cQuality.SetWindowPos(this, qualityRC.left, qualityRC.top, qualityRC.Width(), qualityRC.He...

text and number
i have something like this in a cell: T2 T2 E1 T2 N3 can I add just the numbers and put the answer(10) in an adjacent cell and disregard the text? It might not be practical but how about using the text to columns facility. Select the cell - data - text to columns - fixed width - next - place breaklines between text and numbers - next - finish (no need to format - general is OK) Now the data has been entered in consecutive cells which you may add. As I said it may not be practical - not knowing what other data is in your w/s. -- Russell Dawson Excel Student Please hi...

sum a column containing numbers as well as #N/A
I have a column containing numbers as well as #N/A (result of a Vlooku formula). How do I sum the column to return the total of all numerica values Jack -- jackh Hi Jack Try =SUMIF(A:A,"<>#N/A") Regards Roger Govier jackh wrote: > I have a column containing numbers as well as #N/A (result of a Vlookup > formula). How do I sum the column to return the total of all numerical > values > > > Jackh > > One fix would be to trap the errors rather than leaving them in your worksheet. Instead of =VLOOKUP(A1,J:K,2,FALSE) you can use ...

User Control to Control Other User Control
Has anyone here created a control that controlled the content of other controls? I have my own custom ad control (for displaying space ads). I may have several on a page. What I'd like it to create another control that could determine how many instances of the first control existed on the current page, build a list of ads, and then set each control to show a particular ad. Is this practical? Suggestions? Thanks. Jonathan "Jonathan Wood" <jwood@softcircuits.com> wrote in message news:uQ5stZRnKHA.1552@TK2MSFTNGP05.phx.gbl... > Has anyone...