How to remove the unwanted barcode characted (VBA) - excel

I ran into an obstacle and would like to ask for your help.
How can I solve it that not to show the all scanned characters in textbox.
Original scanned data
P338-7755885BP0097170824
Necessary data (that's what I want to display in textbox)
338-7755885

Related

CodeModle.Insertlines drops variables

After several days of searching Excel vba forums I have finally given in and must now ask for help.
The problem is that CodeModle.Insertlines causes excel to drop all variables. I have a couple arrays that I need to use / check boxes and list boxes etc. all get wiped when I run the code below
With Application.Workbooks(ActiveWorkbook.Name).VBProject.VBComponents("UserSavedQueries").CodeModule
.InsertLines 2, "tmp = " & """" & "THIS IS SOME SAMPLE TEXT " & """"
End With
I fully admit that the Insertlines was a bit of a work around as a way to an end, but that way now seems blocked. Please can someone advise how to insert lines into a module without resetting all variable?
For the bigger picture (and for someone to advise how I probably should have tackled this in the first place)
I have a sheet that pulls together a bunch of parameters from list boxes, checkboxes cells etc when a user selects the ‘Go’ button.
the selections are formatted to make a JSON message that is sent to an API and the response is displayed in a table on a second sheet.
To give some context, Imagine Listbox1 called “search criteria” with selections of “Manufacturer, Colours, Countries”. Listbox2 called “Filters” changes context depending on the selection on Listbox1. So we could have for Listbox2: “Ford, BMW, Nissan” , “Red, Blue, Green, Black, White”, “ ”. Not the actual data but it shows the varying length of each selection. There are actually around 12 available selections some of which have 100+ filter options.
The user may select “Ford, Red” which would return red Fords in all countries or “Ford,BMW,Green,Scotland” which would just Green Fords and BMWs in Scotland.
All of this works nicely.
NOW: I need to add the ability to have “Saved User Selections”. I need to avoid dumping these selections in a worksheet (even hidden) as it allows the user to “fiddle” with the shape and format of the selection which will break the JSON parsing. So I decided to save the user selections in a VB module. A UserForm provides the ability to Name the saved selection, date-stamp it and runs the code above. Parsing the UserSavedQueries module returns a listbox of all saved selections, which, when double-clicked are intended to populate listbox1 & 2 ready for the user to hit ‘Go’.
Considered options: I haven’t ruled out saving to an external file, or maybe even registry, but would prefer to keep self-contained within the one file.
This article came closest to helping, but I'm not sure how it would work for my use-case

Conditional text in a text box depending on drop down box values

I'm having all sorts of fun trying to get a text box to display a message depending on the contents of two dropdown selection boxes.
I have a small list of messages I would like displayed depending on what the dropdown box contents are eg.If dropdown box 1 (contained in cell N7) had ON selected AND dropdown box 2 (in cell N8) was also ON then a message contained in cell AA25 would populate the message box. Similarly, if N7=yes and N8=no then the text contents of AA26 would show up instead.
If none of the conditions are true then I need a blank box (necessary) or even a random text from a list of inspirational quotes!! (Not entirely necessary but it would be fun!!)
I know how to link a message box to a cell content but each time I try to use boolean it tells me I'm missing something! I tried some of the examples listed on other folk's questions to no avail.
Here's my somewhat simple code when I try to use boolean..
=IF $N$7="ON" AND $N$8="ON" THEN $AA$25 Very basic as you can see but I like simple!!
I get a range reference or defined name error.. as you can tell, I'm new to this but learning slowly. Any help would be appreciated. Eventually there will be several IF/AND/OR statements in the conditions with different text for each result.
Thank you.

Value of the cell moves to the left after editing in the userform

I have been facing a strange issue lately. So, the user has the ability to change value of the cell from the userform window, however, after apply changes somehow the values go from the right to the left (only ones with decimals) and that creates a problem when the data is read by another software (Matlab) it can not be read. I have tried to reformat it as number or general to see what happens but nothing. The only thing that changes it back to the right is (find & Replace "," with ","). Anyone knows why this happens? Any solutions ? (see picture for demonstration)
Maybe look in the code for the user form. As I understand it the edit box treats everything as a string. So when the number goes initially from the sheet to the form it is converted into a string. Hence when it is written back, the sheet thinks it’s a string. In the code underlying the form you need to intervene and turn the string back to a number (eg using CDbl() ). If you enter a value (or change) a number directly on the sheet, Excel will try and be ‘helpful’ and convert things that look like numbers into numbers (it does the same with dates). – Solution by #DS_London

Excel Text box doesn't show half of the text

I have created a calculator in excel in which i have used text boxes as input titles. I have tried multiple things to in the formatting section and text appears clear to me on my laptop however my colleagues unable to see those text box completely, all they see is text box is cutting from the end.
I cannot use cells because of the structure of the calculator, hence i have used text boxes with some effects.
Can someone please help me resolve this issue, this is very crucial thing to resolve.
Thank you in advance.
Screenshot of Calculator page is attached.

form view in excel for a record

I have a sheet in excel that is basically like a database (yes it has to be in excel unfortunately) and I want to design a simple form to display the records (the different column values in the rows). Usually MS is good with making widgets to do this but I cant seem to figure out how to write it in VBA (easily)
Basically I have a list of Names and ID#'s then some other columns that need to be filled in (address, order # etc) but I'd like the user to do this via a form rather than typing in excel. I created a small form in VBA, but now I cant link the columns to the textboxes in the form.
Anyone know of any code I can plug and play to do this.
Specifically I am using a ComboBox (for the list of names) and then a for loop searching through it to find the selection and updating data. But its a real pain.
plus I cant figure out how to put in a 'Next' button, which is really annoying me. Does anyone know how to change the comboBox value to the next row, if it is linked via RowSource
Have you considered the Form feature? You can find under the commands you can add to your QuickAccess toolbar.
Check this helpful tutorial for additional details.

Resources