VBA excel selstart and sellength issue

edatawiz

New Member
Joined
Jun 11, 2009
Messages
1
I have been working on a small project to import set of records from a text file and to split them into columns in excel.

I have designed a vba form that takes inputs from a mail copy and use regex patterns to capture and split the text.

Sample input

ID# start date end date cutomerid descr
2334 06/05 10:10 06/05 12:10 24456 Jonh - The user has had requested access to storage department.

2338 06/05 11:10 06/05 13:10 24459 Johna - payroll recheck needed.

I instruct user to copy paste the information into a text box in a form and use regex to capture each record. I am trying to highlight each of the record identified in the text box. Instr gives the correct position but when I use textbox1.selstart and sellength the text is not highlighted correctly. Meaning the position which instr gives cannot select the start position using selstart. The two values differ. I guess instr does not take into account non printable characters but selstart does.

How this can be resolved ?:(
 

Some videos you may like

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Watch MrExcel Video

Forum statistics

Threads
1,122,710
Messages
5,597,702
Members
414,164
Latest member
ARTW

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top