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

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
How are the TRUE/FALSE values getting to C2 etc?
 
Upvote 0
to add an "H" to each cell in each column that represents a holiday
Further to what Fluff has asked if cell C2 says TRUE which cells exactly would you want the H to appear in?
 
Last edited:
Upvote 0
The observed holidays are on the yearly totals worksheet and each month worksheet displays the month and year in row 1. Each day of the month is displayed in row 5. So my formula in row 2 is taking the mm/dd/yyyy from a month worksheet and comparing it to the totals worksheet using if(isna(vlookup
 
Upvote 0
Column C being day 1, I would like the "H" to show in C6, C7, C12, C13, C18, C19, etc. for day 1. Column D being day 2, the "H" would be in D6, D7, D12, D13, D18, 19, etc. for day 2. Column E being day 3 ......
 
Upvote 0
Do you just want to show a H in the cell if it contains TRUE?
If so what is the complete formula that you are using?
 
Upvote 0
The complete formula to determine "T" or "F" is: "IF(C4="","F",IF(ISNA(VLOOKUP(TEXT(DATE(Calendar_Year,MONTH(DATEVALUE(LEFT($Q$1,FIND(CHAR(58),$Q$1)-1)&"1")),DAY(C5)),"mm/dd/yyyy"),Observed_Holiday,1,FALSE)),"F","T"))"

The reference to C4 is where I determine how many days there is in each month. And yes, just show an H if TRUE.
 
Upvote 0
For each day and each employee, we enter a "V" for vacation, "S" for sick, "F" for FMLA, "P" for personal, etc. and depending on the code, CF fills the cell color. I was trying to make "H" automatic based on the date and I have done the fill color but can't figure out how to do the "H".
 
Upvote 0
Ok either replace the "T" with "H" & change your CF accordingly,
or
replace the final "T" with 1.
Then change your Cf to look at cells with 1 rather than T & in the format select custom number format & use "H" as the format
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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