VBA code to change cell contents

Damo10

Active Member
Joined
Dec 13, 2010
Messages
460
Hi,

I am creating a sheet for holiday booking for my employees and need some code to change the contents of the cells from "B" to "T" if the current date is equal to or greater than the booking date.

I have a sheet with all the dates for the holiday period in column C and the employees names are in row 9.
When i book a holiday I will enter "B" in the cell for that employee that matches their name and date requested, I would then like a macro to run on the sheet being opened that will check all rows in range "Data" and if the cell contains a "B" and the current date is equal to or greater than than the date in column C then change it to "T". The macro would need to check all columns in the range "Data" and then move to the next row and repeat until all rows have been checked.
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Are the cells in "Data" and the linked cells in column C adjacent? What's the layout of this sheet?

Copy a row from Excel and paste it into the forum's message window.
 
Upvote 0
Hi,

Sorry for the delay in replying.

Here is a scrren shot of part of the sheet, I would like the code to change all the "a"'s to "h" when there is an "a" and date in column D is the same or less than todays date

Excel Workbook
CDEFGHIJKLM
20Friday01/06/2012
23Saturday02/06/2012
26Sunday03/06/2012a
29Monday04/06/2012a
32Tuesday05/06/2012a
35Wednesday06/06/2012a
38Thursday07/06/2012a
41Friday08/06/2012a
44Saturday09/06/2012a
47Sunday10/06/2012a
50Monday11/06/2012
53Tuesday12/06/2012
56Wednesday13/06/2012
59Thursday14/06/2012
Sheet1
Excel 2010
Cell Formulas
RangeFormula
C20=TEXT(D20,"dddd")
C23=TEXT(D23,"dddd")
C26=TEXT(D26,"dddd")
C29=TEXT(D29,"dddd")
C32=TEXT(D32,"dddd")
C35=TEXT(D35,"dddd")
C38=TEXT(D38,"dddd")
C41=TEXT(D41,"dddd")
C44=TEXT(D44,"dddd")
C47=TEXT(D47,"dddd")
C50=TEXT(D50,"dddd")
C53=TEXT(D53,"dddd")
C56=TEXT(D56,"dddd")
C59=TEXT(D59,"dddd")
D23=D20+1
D26=D23+1
D29=D26+1
D32=D29+1
D35=D32+1
D38=D35+1
D41=D38+1
D44=D41+1
D47=D44+1
D50=D47+1
D53=D50+1
D56=D53+1
D59=D56+1
 
Upvote 0
Is this possible to have a macro go through all the columns and change the a's to h's if the gate in column c is equal to ir less than the current date?
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,286
Members
452,902
Latest member
Knuddeluff

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