ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Detecting Ctrl-Tabs in User Form input fields? (https://www.excelbanter.com/excel-programming/323809-detecting-ctrl-tabs-user-form-input-fields.html)

Don Wiss

Detecting Ctrl-Tabs in User Form input fields?
 
I have a user that somehow after entering a date in a user form text box
hit Ctrl-Tab a few times. This put some sort of non-prinatble characters
after the input. Then closing the form put the input in a spreadsheet cell
and formulas dependent on this cell errored out. And then macros reading
these errors crashed. Anyway to prevent or detect input like this?

Don <donwiss at panix.com.

Jim Thomlinson[_3_]

Detecting Ctrl-Tabs in User Form input fields?
 
You can use the Clean function to remove non-printable characters something
like this:

Sheet1.Range("C3").Value = Application.Clean(Sheet1.Range("C2").Value)

This takes the Cell in C2 and removes the non printable characters and
places the resutl in C3

To test it put =CHAR(7) & "Text" in Cell C2...

HTH

"Don Wiss" wrote:

I have a user that somehow after entering a date in a user form text box
hit Ctrl-Tab a few times. This put some sort of non-prinatble characters
after the input. Then closing the form put the input in a spreadsheet cell
and formulas dependent on this cell errored out. And then macros reading
these errors crashed. Anyway to prevent or detect input like this?

Don <donwiss at panix.com.



All times are GMT +1. The time now is 09:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com