Auto select textbox contents on mouse over

Datanology’s Data Mining projects, extracting the useful and valuable data from large sets of data uses this kind of process regularly, in conjunction with other processes to make data mining accurate and quick, thus reducing the cost of completing a process. By reducing the number of clicks a user makes, large time savings can be made as the size of the data increases.

This example code is very short but immensely powerful in Data Mining. Applied to a userform textbox, listbox or combobox it will automatically highlight the text within said control when the mouse cursor moves over the control. It eradicates the need to find the end or beginning of the text or word, click and drag to the other end, release click before copying. Applied to several controls means that as you hover over from one to another, only the current text is highlighted ready to copy.

We use this code for data mining and cleansing and can reduce the time taken quite drastically, as well as reducing any fatigue associated with mundane actions such as highlighting, cutting then pasting. Contact us using the form or leave a message for assistance with your Excel project.



Private Sub TextBox1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

With TextBox1
.SelStart = 0
.SelLength = Len(.Text)

End Sub






Contact us for some advice and guidance on how your Excel development could be created and start helping your business straight away. Contact Us

Datanology

Leave a Reply

Your email address will not be published. Required fields are marked *