VB to add text to cell based on text of another cell ....

notruck

New Member
Joined
Jan 19, 2011
Messages
34
Hello All,

I have a workbook that is used to track employee absence. There are 13 worksheets, 1 for yearly totals and 1 for each month of the year. Using CF, I am filling cells that equal holidays but would like to add an "H" to each cell in each column that represents a holiday.

Right now, in each of the month worksheets, C2 will display TRUE or FALSE for the 1st day of that month. TRUE if it is a holiday or FALSE if it is not. D2 is the 2nd day of that month, E2 is the 3rd day, etc.. My CF references C2 and if it is TRUE, changes the fill color for the needed column/rows. I can do a lot with Excel but have no clue how to use VB.

Anyone have an idea or even understand what I'm trying to ask?
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Have you tried either of my suggestions in post#9?
 
Upvote 0
I don't think or don't understand how post #9 would work which is why I included a screen shot. The "T" is in row 2 and the font color is normally white so it cannot be seen. The "H" needs to go in a normally text cell in rows 6, 7, 12, 13, 18, 19, etc..
 
Upvote 0
What is in the cells where you want a H?
 
Upvote 0
Nothing .... We enter "V" for vacation day, "S" for sick day, "P" for personal day, etc ... With CF to change the fill color depending on which letter is used. So for holidays, I can change the fill color but would like to auto insert the "H".
 
Upvote 0
CF cannot add text to cell, only change the way it looks.
Why not just put a formula in those cells, like
=IF(C$2="T","H","")
 
Upvote 0
If a formula is added to those cells, it would need to be deleted or overwritten when the manager is entering a "P", "S", or "V"?
 
Upvote 0
Yes, but if it's a Holiday why would you be entering anything in that cell?
And if it's not a holiday, it doesn't matter if the formula is overwritten.
 
Upvote 0
I guess. I just thought it would be cleaner to have VB add the "H" automatically instead of adding a formula to hundreds of cells. Thank You.
 
Upvote 0
To have a macro run automatically, you would need a calculation event because those cells are being changed by a formula.
If you only have formulae in row 2, it would be ok, but if you have a lot of other formulae in that sheet, the event could be triggering a lot & therefore slow down the workbook.
 
Upvote 0

Forum statistics

Threads
1,223,954
Messages
6,175,601
Members
452,658
Latest member
GStorm

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