I want to change a letter color automatically when i type it. For example a = red; b = blue; c = yellow and so on..
I want to change a letter color automatically when i type it. For example a = red; b = blue; c = yellow and so on..
Type where? In cell, you can't do that, as VBA code cannot run while you are in cell edit mode.
However, it can be achieved after you confirm your entry in a cell. Note that this will bloat file size and may add overhead to workbook performance.
?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
― Robert A. Heinlein
Yes, when i type a letter in a cell i want that it changes the color based on a legend.
Vba runs after i type that letter, when i press enter the color changes..
Are you typing just one letter in the cell or are you typing many letters in the cell? If many, do you want to change all letters even if they are inside words?
Something like below. Code currently set to only apply when single cell value is changed in Column A of sheet where code is pasted in.
Adjust and play with it as you need.
If it's single character cell only, just use CF or limit the code above by checking Len(Target.Value) = 1Please Login or Register to view this content.
Thank you, i will try now.
Not valid argument, run-time error '5'
At which line?
Tested and works fine on my end.
See attached. Cell's fill color changed to make font color more visible.
Hmm.. that's strange, let me attach an image.
This is where the magic should happen : Attachment 641779
Invalid attachment. Try using "Go Advanced" and attach image.
Or even better, upload sample workbook where you are receiving that error (or smaller sample where you can replicate the issue).
Maybe this could work : https://imgur.com/a/aHxkBKP
That doesn't help at all. Image tells me nothing of "how" you implemented the code. And which specific line in the code generated that error.
Also, from image, it's near impossible to tell, the full scope requirement for the code.
I am gonna type only one letter per cell
The error is in this line :I put the code in a function module, but there is no button that calls that function. So what element in the code calls that Sub to apply changes immediately?Please Login or Register to view this content.
It's not a function. It's a sub routine that should go in Worksheet module (of the sheet where you want to apply font color).
And code is triggered on worksheet_Change event.
Check by going to VBE in the sample I uploaded. You will see that it's in Sheet1 module.
Yes.. in fact i was naming the Sub with a casual name, then I realized that I had to put that specific name.. now no more errors but when i set my interval in the range parameters Range("WW:WW"), the color doesn't change.
Upload sample workbook. My guess, is that you don't have specific letters mapped out in Case statement.
But without sample workbook, I'll be wasting time going back and forth, trying to guess what you are doing.
To upload, use "Go Advanced" button, follow "Manage Attachments" hyperlink. It will launch new tab/window for managing uploads.
Sorry for that but my Manage Attachments button doesn't work.
Don't use the shortcut button. Use "Go Advanced" button. It will open up more interface, which has "Manage Attachments" hyperlink (not shortcut button).
Shorcut button hasn't worked for a while now.
Okay here it is, try to put letter k in column WW
You uploaded ".xlsx" which doesn't support macro...
So I've got no clue what your modified code looked like.
Modifying my code a bit, works fine.
Oh thanks, you saved me.
Show us the exact code you tried to use that did not work for you.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks