textbox cannot enter letters and numbers

Patriot2879

Well-known Member
Joined
Feb 1, 2018
Messages
1,081
Hi hope youcan help me please, I have attached the file below which I am stuck on, I havea user form ‘enter expenses’ but when I try to enter number/letter combinationin the boxes for Airfare, accommodation, ground transport and food and drink,the box goes red when I click on update and it doesn’t transfer the informationto the enter expenses sheet, I hope you can help me please?
https://www.dropbox.com/s/r6k2c5lln3m1ij8/Copy%20of%20Excel-Forms-Insert-Update-Delete.xlsm?dl=0
 

Some videos you may like

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
36,428
Office Version
  1. 2010
Platform
  1. Windows
I just tried your UserForm... as long as you put numbers only into the Airfare, Accommodation, Ground Transport, Food & Drink and Misc. fields, everything seems to work fine. What "letters" are you trying to place in those fields and, more importantly given they seem to be expecting currency amounts, why?
 

Patriot2879

Well-known Member
Joined
Feb 1, 2018
Messages
1,081
Hi I wantedto put like areas or initials with age(SA47) andwhat food eaten or drank for example wine and steak , originally it was the priceof things but I do not need this now.
 

Patriot2879

Well-known Member
Joined
Feb 1, 2018
Messages
1,081
originally the currency was for the pricing of food, airfare etc but I don't want to count this now, I would prefer to record where accommodation is or the postcode for example what they had to eat and like a reference numbers etc which includes numbers and letters hope you can help me please?
 

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
36,428
Office Version
  1. 2010
Platform
  1. Windows

ADVERTISEMENT

Hi I wantedto put like areas or initials with age(SA47) andwhat food eaten or drank for example wine and steak , originally it was the priceof things but I do not need this now.
You have a function named IsAcceptedNumber which is testing values and seeing if the value entered into the TextBoxes are able to be converted to Double data types or not. You need to use VBA's Find (set the search for entire project) to find where this function is being called and, for whichever TextBoxes you want to allow text to be entered, stop the code from calling that function.
 

Patriot2879

Well-known Member
Joined
Feb 1, 2018
Messages
1,081
wow OMG that is well over my head, sorry I am quite new to this and still learning, is it quite easy to change/update?
 

Patriot2879

Well-known Member
Joined
Feb 1, 2018
Messages
1,081

ADVERTISEMENT

thank you for the advise, hope you can still help me please as I don't know what to do now.
 

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
36,428
Office Version
  1. 2010
Platform
  1. Windows
thank you for the advise, hope you can still help me please as I don't know what to do now.

I am about to go to sleep for the night right now, so I cannot look at it yet. However, I will need to know which TextBoxes are now supposed to be able to take text instead of numbers. Also, once the TextBoxes are modified to be able to take text, what happens to the Total row at the bottom of the table (given that you cannot total ups non-numeric values)?
 

Patriot2879

Well-known Member
Joined
Feb 1, 2018
Messages
1,081
Hi, the total box at the bottom and to the right, this will need to be deleted, the textboxes that I want to be changed to text/numbers are, airfair, accommodation, misc, food and drink, ground support, thankyou for the help.
 

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
36,428
Office Version
  1. 2010
Platform
  1. Windows
Hi, the total box at the bottom and to the right, this will need to be deleted, the textboxes that I want to be changed to text/numbers are, airfair, accommodation, misc, food and drink, ground support, thankyou for the help.

Let me start by saying I did not review your entire project, but given what you say you want the code to be able to do, I think the following suggestion will do it correctly for you. In the ExpensesForm UserForm's code window is a function named CheckForErrors... inside it is a For Each loop with a Select Case TypeName(Ctrl) statement... the first code block inside that Select Case is the Case "TextBox" code block... I think you need to comment out the entire Else block (you could delete it, but if I am wrong, it would be hard for you to reestablish the code, so I recommend commenting it out instead). Once you have done that, it looks like the code will accept text in all the TextBoxes on the UserForm.
 

Watch MrExcel Video

Forum statistics

Threads
1,114,323
Messages
5,547,240
Members
410,779
Latest member
che55ysia
Top