VB macro for highlighting rows if conditions are met

keibeezy

New Member
Joined
Jul 8, 2010
Messages
9
I am making a schedule for work and need help with a VB macro.
in column A10:A30 i have a person's name, and in the adjacent Column B10:B30 I have their regular days off, represented by a two-letter code.
MT=monday/tuesday
TW=tuesday/wednesday
WT=wednesday/thursday
TF=thursday/friday
FS=friday/saturday
SS=saturday/sunday
SM=sunday/monday
In cell C3, If I type in MONDAY for the day, i want it to highlight each row that has the letter "M" next to their name, and so on for the rest of the days of the week. and if it could return the text "RDO" in the adjacent cell in column C automatically. Ive had no luck searching for a similar macro. help please?
 
The following will unhighlight the rows (it's part of what is built into the original macro to clear before re-running)

Code:
Sub unhighlight()
With Sheets("Sheet1")
    .Range("B10:B30").EntireRow.Interior.ColorIndex = 0
    .Range("C10:C30").ClearContents
End With
End Sub

I would assign the macros to a button or a shape on the worksheet. See How To: Assign a Macro to a Button or Shape | Peltier Tech Blog | Excel Charts for details.
 
Upvote 0

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
how can i return H blank if G is blank?
And also only highlight across to the I Column.
And i still cant get it to run without going to vb and hitting run manually.
How do I get it to start automatic when i open the workbook?
Sorry if i wasnt clear, but other than that this code is perfect. Thanks so much for the help
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,099
Messages
6,170,109
Members
452,302
Latest member
TaMere

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