Advancing A Number With The Push A Button

Greeting,

I have an invoice that uses a button to advance the invoice number by
1.  When I wrote it the numbers were just numbers, but since then a
letter has been added to the front of the number (was 17445 now
D-017445).  My advancing code no longer works and I don't know why!

Here is the code:

	Private Sub GetNextInv_Click()
	    Range("InvNoLast").Value = Range("InvNoLast").Value + 1
	End Sub

Anyone have an idea on how to fix it?

Any help would be most appreciated.

TIA

-Minitman
0
exreply (43)
7/31/2004 7:13:04 PM
excel.misc 78881 articles. 5 followers. Follow

5 Replies
423 Views

Similar Articles

[PageSpeed] 23

Hi
one idea:
why not format the cell with the custom format:
"D-"000000

This way you still store the numbers but show the characters


--
Regards
Frank Kabel
Frankfurt, Germany


Minitman wrote:
> Greeting,
>
> I have an invoice that uses a button to advance the invoice number by
> 1.  When I wrote it the numbers were just numbers, but since then a
> letter has been added to the front of the number (was 17445 now
> D-017445).  My advancing code no longer works and I don't know why!
>
> Here is the code:
>
> Private Sub GetNextInv_Click()
>     Range("InvNoLast").Value = Range("InvNoLast").Value + 1
> End Sub
>
> Anyone have an idea on how to fix it?
>
> Any help would be most appreciated.
>
> TIA
>
> -Minitman

0
frank.kabel (11126)
7/31/2004 8:39:48 PM
It no loger works because D-017445 is text, not a string.  Addition with 
strings is not defined.

Try

Private Sub GetNextInv_Click()
     Dim x As String
     x = Range("A1").Value
     Range("A1").Value = Left(x, 2) & Application.Text(CDbl(Mid(x, _
         3, Len(x) - 2)) + 1, "000000")
End Sub

Jerry

Minitman wrote:

> Greeting,
> 
> I have an invoice that uses a button to advance the invoice number by
> 1.  When I wrote it the numbers were just numbers, but since then a
> letter has been added to the front of the number (was 17445 now
> D-017445).  My advancing code no longer works and I don't know why!
> 
> Here is the code:
> 
> 	Private Sub GetNextInv_Click()
> 	    Range("InvNoLast").Value = Range("InvNoLast").Value + 1
> 	End Sub
> 
> Anyone have an idea on how to fix it?
> 
> Any help would be most appreciated.
> 
> TIA
> 
> -Minitman
> 

0
post_a_reply (1395)
7/31/2004 8:40:58 PM
Thank you Frank and Jerry,

One other problem, how would I modify this code to use a ScrollBar?

-Minitman

On Sat, 31 Jul 2004 20:40:58 GMT, "Jerry W. Lewis"
<post_a_reply@no_e-mail.com> wrote:

>It no loger works because D-017445 is text, not a string.  Addition with 
>strings is not defined.
>
>Try
>
>Private Sub GetNextInv_Click()
>     Dim x As String
>     x = Range("A1").Value
>     Range("A1").Value = Left(x, 2) & Application.Text(CDbl(Mid(x, _
>         3, Len(x) - 2)) + 1, "000000")
>End Sub
>
>Jerry
>
>Minitman wrote:
>
>> Greeting,
>> 
>> I have an invoice that uses a button to advance the invoice number by
>> 1.  When I wrote it the numbers were just numbers, but since then a
>> letter has been added to the front of the number (was 17445 now
>> D-017445).  My advancing code no longer works and I don't know why!
>> 
>> Here is the code:
>> 
>> 	Private Sub GetNextInv_Click()
>> 	    Range("InvNoLast").Value = Range("InvNoLast").Value + 1
>> 	End Sub
>> 
>> Anyone have an idea on how to fix it?
>> 
>> Any help would be most appreciated.
>> 
>> TIA
>> 
>> -Minitman
>> 

0
exreply (43)
7/31/2004 10:27:07 PM
Why a scrollbar - do you want to advance or regress many numbers at a time?

-- 
Regards,
Tom Ogilvy

"Minitman" <exreply@i-m-pNOSPAM.net> wrote in message
news:hq6og05h38omge5j5623hqkn851hle9ndq@4ax.com...
> Thank you Frank and Jerry,
>
> One other problem, how would I modify this code to use a ScrollBar?
>
> -Minitman
>
> On Sat, 31 Jul 2004 20:40:58 GMT, "Jerry W. Lewis"
> <post_a_reply@no_e-mail.com> wrote:
>
> >It no loger works because D-017445 is text, not a string.  Addition with
> >strings is not defined.
> >
> >Try
> >
> >Private Sub GetNextInv_Click()
> >     Dim x As String
> >     x = Range("A1").Value
> >     Range("A1").Value = Left(x, 2) & Application.Text(CDbl(Mid(x, _
> >         3, Len(x) - 2)) + 1, "000000")
> >End Sub
> >
> >Jerry
> >
> >Minitman wrote:
> >
> >> Greeting,
> >>
> >> I have an invoice that uses a button to advance the invoice number by
> >> 1.  When I wrote it the numbers were just numbers, but since then a
> >> letter has been added to the front of the number (was 17445 now
> >> D-017445).  My advancing code no longer works and I don't know why!
> >>
> >> Here is the code:
> >>
> >> Private Sub GetNextInv_Click()
> >>     Range("InvNoLast").Value = Range("InvNoLast").Value + 1
> >> End Sub
> >>
> >> Anyone have an idea on how to fix it?
> >>
> >> Any help would be most appreciated.
> >>
> >> TIA
> >>
> >> -Minitman
> >>
>


0
twogilvy (1078)
7/31/2004 10:54:56 PM
No.  But I have never used one and wanted to get a little experience
with them.

On Sat, 31 Jul 2004 18:54:56 -0400, "Tom Ogilvy" <twogilvy@msn.com>
wrote:

>Why a scrollbar - do you want to advance or regress many numbers at a time?

0
exreply (43)
8/1/2004 1:11:28 AM
Reply:

Similar Artilces:

Activities don't show up until we hit the refresh button
Hello all, We upgraded from 3 to 4 and it appears that the upgrade did not complete successfuly, but the users used the system. Everything appears to be working well except for a couple of strange things like when we create an activity the activity does not appear until we hit the Refresh button, going to history and coming back does not fix the issue, only the refresh button any quick fix on this one? thanks ...

Access Code Pushing Values
I have a customer database with [BillAddress] and [ShipAddress]. I am using a "yes/no" box titled[SameShipAddress?]. To automatically fill [ShipAddress] after checking the "yes/no" box I used this code in the after update event for the check box. If Me![SameShipAddress?] Then If IsNull(Me![BillAddress]) Then Else [ShipAddress] = [BillAddress] End If End If This works for the selected customer, but then pushes the entry [BillAddress] of the previous customer to [ShipAddress] of all of the following customers. Any thoughts? Sounds as...

Money 2006 Standard
I've just started to use the Money 2006 and I'm trying to move from the Essential Budget to the Advanced Budget, but the software does not move to the selected option. Is there any action to correct this problem? I was using a very old Money version (97) and the file was converted without any problem with budget data in the Advanced format, but as I can't select the Advanced Budget I'm not able to change anything in it. Is it possible to somebody help me on solving this problem? Thank you very much -- Bob Campos Have you tried doing a File - Repair, Bob? -- Michael Gor...

Send button --WEBBOT SELF--
I wrote the earlier question and then kept looking for answers. I found the following at MSMVPS.com After the form is submitted the page is redirected to a confirmation page. You cannot change that function nor change the confirmation page. That is not available in Publisher. If this is true then how am I going to get my form page to work. Please help me!!! reference: Publisher web publication forms 101: http://msmvps.com/blogs/dbartosik/archive/2006/01/07/80564.aspx Reference: How to publish a Publisher web in HTTP: http://msmvps.com/blogs/dbartosik/pages/80557.aspx Applicable if yo...

Determine Which Button was Right-Clicked?
All, I am using the code below (started from a sample from one of these groups) to programmatically create a series of buttons in a vertical strip on a form on Form Open. I have a context menu which appears when the user right-clicks any button on the form. How do I "tell" the context menu (really a function on the context menu) which button was right-clicked? I know how to get button attributes when the user left-clicks...but that's not what I need... Is there a way to do this? Thanks, Patrick Code::: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: ...

Calculate number of months
Hello, I have a field where I am trying to implement a calculation. I want it to take the date in a cell and subtract it from today's date to show me the total number of months between those two dates. So right now, it looks like =(TODAY())-D3 and it returns 167 - the total number of days. How do I make it show me months? THANK YOU IN ADVANCE =Month(Today())-Month(D3) "TxWebDesigner" <beverly@beverlylanedesigns.com> schreef in bericht news:e3fR#jXWJHA.5032@TK2MSFTNGP05.phx.gbl... > Hello, > > I have a field where I am trying to implement a calculation...

How can I prioritize tasks by number in Outlook 2007?
I am trying to create a custom priority for my tasks in Outlook 2007, but I'm not able to edit the field that was created when I changed the settings to include a custom priority. I'm trying to put a number into it, so that I can sort my tasks in a certain category by number, but I'm not able to. We aren't watching you and your explanation is missing details. Where in Outlook are you trying to view the Tasks? There are 3 places to see Tasks. If in the Task Folder, what View are you in? If in Tasks folder you probably need to turn on in-line editing. Regards Judy Gle...

I have a problem with getting a total Sum of numbers (URGENT)
I'd really appreciate if someone could help me here. I am using Microsoft Excel 2002 on a Microsoft Office XP system. I a trying to develop a minor league baseball schedule, but am having som problems. I have attached a copy of my spreadsheet to give everyone some idea o what I'm doing here. I have where the fans list the "RUNS, HITS & ERRORS) of both teams an for each game of the series. I then have it set up in the TOTA WON/LOST column where if the T-Bones RUNS are more than the SALTDOG runs, a "1" appears in the WON column. If the SALTDOGS have a highe numbe...

xp desktop and start button missin
cant get into to windows even in safe mode have to go to task manager to open anytgin In task mgr,locate "new task",type: cmd In cmd type: CHKDSK C: After,you may want to type: Sfc /Scannow Install xp cd,exit the menu page.Once its thru,remove xp cd,type: CHKDSK C: /F Agree to restart,type: EXIT Restart pc. "jen" wrote: > cant get into to windows even in safe mode have to go to task manager to open > anytgin ...

Stop Buttons showing when opening up form
I have a button on my Main Start up page that when click makes these buttons visible, but when I open up my DB they automatically show on start up, is it possible they not be visible till I click ckbHelp.......Thanks for any Help.....Bob Private Sub ckbHelp_Click() If ckbHelp = True Then cmbHelpNewHorse.Visible = True cmbHelpActFinHorse.Visible = True End If If ckbHelp = False Then cmbHelpNewHorse.Visible = False cmbHelpActFinHorse.Visible = False End If End Sub Bob, In design view, set the property pf the *button* Visible=No Regards/Jacob "Bob" <xxx@xx.xx> wrote i...

number in system using arrivals and departures
Is there and easy way to figure out the total number of persons in a system if have access to the arrival and departure times. I have tried to use counts with if statements, but I keep getting the number 1. I know this is not correct. Is there any special macros or functions Thanks Hi you may provide some more details about your data. Could you post some example rows (plain text - no attachments please) and describe your expecte result -- Regards Frank Kabel Frankfurt, Germany megv wrote: > Is there and easy way to figure out the total number of persons in a > system if have access...

How to change caption on 'apply' button in a CPropertySheet-derived class?
Hi, Does anyone know how to change the caption on the 'apply' button in a CPropertySheet-derived class? I derived a class CPlotSettingsDialog1. Here is it's OnCreate. int CPlotSettingsDialog1::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CPropertySheet::OnCreate(lpCreateStruct) == -1) return -1; CRect WindowRect; GetWindowRect(&WindowRect); WindowRect.bottom = WindowRect.bottom + 60; MoveWindow(&WindowRect); return 0; } all the code does is make the bottom of the property sheet a bit longer. It still has the 3 default buttons. I need to either re-caption t...

how would you calculate the number of hits to your website
Hi ,' can some one tell to me the answer of this question On a website, how would you calculate the number of hits to your website ...

columns changed to numbers instead of letters?
I noticed my excel clumns have changed from letters to numbers and forumlas now look like =RC[-1]*R[-3]C[6] I was trying to make the R[-3]C[6] static (using the $) but it errors. Thanks Mike In Excel Options uncheck "R1C1 Reference Style" Gord Dibben MS Excel MVP On Thu, 28 Oct 2010 20:25:30 -0400, Mike <no_please@not.com> wrote: >I noticed my excel clumns have changed from letters to numbers and >forumlas now look like =RC[-1]*R[-3]C[6] >I was trying to make the R[-3]C[6] static (using the $) but it errors. >Thanks >Mike ...

A way to increase a number in a cell by using the + key
Hi, i do a lot of data entry and am looking for a way to increase the number in a cell (or range of cells) so that i dont have to enter the new number in each time. I have columns that separate items and i use the sheet to show the total count for each item in it's row. eg Item 1 Item 2 Item 3 2 5 4 I'd like to use the + key only to increase the counts for each item. Did i make sense?? It's a Friday and my mind isn't quite up for a lot of detailed explanations, lol. Any assistance would be appreciated. Tim That would require VBA How far are you will...

reference number #2
--------------------------------- Where does the information in the "reference number" field in the transaction table come from? I see tranactions with reference numbers - the first part of which appears to be the year, month and day - but I can't figure out the second part. It is nothing that we have intentionally entered while ringing out the customer. Pls help. -Tracey ##-----------------------------------------------## Newsgroup Access Courtesy http://www.rockryno.com/ Tax and Accounting Software Forums Web and RSS access to your favorite newsgroup - microsoft.p...

Mail Button on ie8
I just started using ie8 and was using hot mail I found out I could use live instead of live hot mail. My question is when I click the mail button it stills shows up hot mail.I set live as my default email but it didn't make any difference On Tue, 15 Dec 2009 13:59:03 -0800, kln wrote: > I just started using ie8 and was using hot mail I found out I could use live ... "Live" what? > ... instead of live hot mail. There are: Windows Live Mail (a desktop client, akin to MS Outlook Express. Windows Live Hotmail (an online email service, accessible by ...

number changes to date ... how do I change
I am trying to do an "age" range: 1-9 10-19 20-29 Instead I get September 9, 2004 or October 19 I can't figure out how to change it. Please help! Thank you! kk Format->Cells->Number Change the type to Text, and it should keep everything the way you want it. If you don't specify a type, Excel takes a guess based on what you enter. Hope that helps. -Bob --- Message posted from http://www.ExcelForum.com/ ...

Add numbers accross columns after stripping away text
I have the following data in a spreadsheet: A1 B1 C1 D1 E1 F1 4.5f 6f 3.5f 3f 7.25f I need to be able to add the numbers together to give me 24.25, i.e. strip the fs away. The numbers will always be less than 10 and the there will only ever be .25 or.5 or .75 after the number (I don't know whether that is significant?). If anyone can show me how to do this I would be very grateful. I have been messing around with MID and FIND to no avail and then started thinking that SUMPRODUCT might have to get involved but it all got a bit m...

Random numbers, Canadian Zip Code style #2
Honestly, I don't even know where to begin -- Shocke ----------------------------------------------------------------------- Shocked's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1489 View this thread: http://www.excelforum.com/showthread.php?threadid=26523 ...

Delay Direct Push
Hi, Wonder if anyone face the same problem as i'm facing... Delay in receiving email at times.... 3 mins at times.... most often 1 min.... No matter if i'm on wireless or GPRS connection.... Can anyone advice? On Sat, 18 Nov 2006 23:39:57 +0800, "Gary Ng" <gary.ng@netplus-asia.com> wrote: >Hi, > >Wonder if anyone face the same problem as i'm facing... Delay in receiving >email at times.... 3 mins at times.... most often 1 min.... > >No matter if i'm on wireless or GPRS connection.... > >Can anyone advice? > What about the lo...

How To apply security roles to ISV buttons/menus
Hi all, Can anyone tell me if it's possible to apply the CRM security roles on the ISV-defined buttons and menus. Because all I've found is to enable or disable ISV for a security role. But what if I want to enable only 2 buttons for role1 and 1button an a menu for role2 ? I've searched throught the ISV definition (msdn) but it seems that you can't define security in the ISV.config So where can it be done ? Thanks a lot DA ------=_NextPart_0001_4105D61B Content-Type: text/plain Content-Transfer-Encoding: 7bit Hi DA, Thanks for your post. Unfortunately, there is no way t...

OWA password button opens email
Hello, Exchange 2003 sp2, server 2003. In OWA when users click on change password, a 404 error appaears, then redirects and opens another window of OWA. Any idea's? TIA, Eric Hi, You have followed this ( http://support.microsoft.com/kb/297121/en-us ) to enable the change password feature? Leif "Eric K" <EricK@discussions.microsoft.com> wrote in message news:1EAE5451-4DCB-4D17-A6BA-AAEB02824644@microsoft.com... > Hello, > Exchange 2003 sp2, server 2003. In OWA when users click on change > password, > a 404 error appaears, then redirects and opens another...

Formatting Numbers to Text or??!!!
I have a spreadsheet that contains the following data: Date Account ID 5/14/08 5280-3-01 5/14/08 5280-3-01 5/14/08 5280-3-01 5/14/08 5280-3-01 5/14/08 5280-3-01 5/14/08 5280-3-01 5/14/08 1030-0-01 5/14/08 1030-0-01 5/14/08 2101-0-01 5/14/08 2101-0-01 5/14/08 2101-0-01 5/14/08 2101-0-01 5/14/08 2101-0-01 5/14/08 2101-0-01 5/14/08 2101-0-01 5/14/08 2101-0-01 When I save it as a .csv file it looks like this: Date Account ID 5/14/2008 3/1/5280 5/14/2008 3/1/5280 5/14/2008 3/1/5280 5/14/2008 3/1/5280 5/14/2008 3/1/5280 5/14/2008 3/1/5280 5/14/2008 1030-0-01 5/14/2...

Passing Variable Number of Arguments to a Sub
Does anyone know how I can do the above. I am constructing a list of arguments in one sub to pass to another. Something along the following lines: Sub One Dim sArgs() As String j = 0 ReDim Preserve sArgs(j) sArgs(j) = Chr(34) & "Arg1" & chr(34) j = 1 ReDim Preserve sArgs(j) sArgs(j) = Chr(34) & "Arg2" & chr(34) Call Sub2(Join( Args(), ",") End Sub Sub2(ParamArray Args()) 'Sub 2 Code End Sub I know the problem lies in the fact that the join statement returns single string. I want to know how I can have the strings separated b comma...