Hello,
This is the first question I post. I have been using the Excel Forum for quite a while now and it has been extremely useful so far for finding answers in older threads so thank you everybody However this time I can’t find anything so I though I’ll ask the question.
As part of a program I’m writing in VBA (for Excel 2010), I have a textbox in a user form used as an interface to write a formula in cells in Excel.
The resulting value of a formula from a cell is loaded up into the textbox. It would be shown in the textbox like “See 1.2 and 1.3” where the formula in the cell is
This is just used as an example but the principle is there.Please Login or Register to view this content.
It is worth noting that I’m writing this for very inexperienced Excel users but I need them to be able to edit the string part of the formula without breaking the formula.
However where I’m struggling is to pick up a selection change event inside a text box already selected. I need to be able to check if the textbox.SelStart is within an address value or within the string in the textbox.
The event Enter won’t work if the user is already editing the textbox (i.e. typing stuff) and then clicking or using the keyboard arrow to move the cursor somewhere else inside the textbox. I don’t think the event Change is the solution either as it would mean that the user would have already typed something and as a result the formula may already be broken.
I have had a good look around and I didn’t find an event for a selection change inside a textbox. Does it exists and/or is there a way that would have the same result?
Many thanks in advance.
Bookmarks