Can you change the forecolor of various portions of text within a userform textbox?

rizzo93

Active Member
Joined
Jan 22, 2015
Messages
303
Office Version
  1. 365
My users must follow a certain format when entering a project summary so that all summaries look consistent from a formatting perspective.

For example, I'm looking for "3/4/19", NOT "03/04/19" or "3/4/2019". Another example is, "Procurement is required" NOT "Procurement must be done". Again, just making things consistent across all user input.

Using formulas within a worksheet, I'm calculating where the problem spots are. I then provide a summary of what needs to be corrected. But I am thinking of taking it one step further by colorizing the problem errors within a textbox to make them more prominent (my team is very visual and doesn't like to read).

So if my textbox starts out with forecolor "vbwhite" and backcolor "vbgrey", I have a checkbox in the userform that will turn all of the text vbgreen and the backcolor to vbblack. But I just want it to make things like the wrongly formatted "03/04/19" to be vbgreen while changing the rest of the text to something dimmer. And if there's another problem spot, that would also be vbgreen.

Ultimately, I'd like one subroutine to go through and find the problem areas, and then call another subroutine to make just those areas a different color.

Can this be done without needing a degree in rocket science?
 
if your formulas can identify the problems, or you can specify/articulate the details via rules/logic, then that means some program code could be written to do the fix-ups

hard to know how involved that would be, but it is hopefully not a big deal. so the users can enter the data just like they do now & the code would change it to what is acceptable

should be easier for everyone? a win-win

just needs some further explanation of the setup and details for people [edit: forum users] to advise (on exact details of the solution/code)

Thanks, Fazza. With some exceptions, my intent is for the content providers to correct their data themselves. I'm just pointing out what they need to correct. But I do agree there must be something more I can do to get my corrections across to them.
 
Upvote 0

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Another interesting option, DanteAmor. Thanks!

Oh and please tell me how you got an image posted into this thread.

Youre welcome.

I put the image in another forum that allows the insertion of images, I copy it and paste it here.
 
Upvote 0
I already asked, where is the user typing their entries?

If they're typing into the form, you can write code that corrects it when they leave the textbox. Or if there are only certain choices available, put them in a dropdown, to save the user typing and save you validation.

If they're typing into cells, use a number format for the date format you want, and use data validation.
 
Upvote 0
Another option to enter dates is to add a date control as DTPicker, that way the date will always be a correct date.
 
Upvote 0
I already asked, where is the user typing their entries?

If they're typing into the form, you can write code that corrects it when they leave the textbox. Or if there are only certain choices available, put them in a dropdown, to save the user typing and save you validation.

If they're typing into cells, use a number format for the date format you want, and use data validation.

Jon,

They're entering their information into an online platform. I then export that information to do further processing. So there's no way to do on-the-fly editing at the time of data entry. There are a few scenarios when I can correct some things when I know what to look for, but the majority of my work is to identify the problem spots after the fact and then notify them to make the necessary corrections.
 
Upvote 0
Another option to enter dates is to add a date control as DTPicker, that way the date will always be a correct date.

True, but I didn't give a clear picture of how the whole process works from data entry to me processing what I receive. So, sorry about the confusion.
 
Upvote 0
Do not worry, now you have several ideas for your process
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,209
Members
453,023
Latest member
alabaz

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
Back
Top