change date based on a code

donlincolnmre2

Board Regular
Joined
Dec 23, 2006
Messages
142
Hello

I have a spread sheet with 3 columns column A contains Date, Column b contains some data and Column D contains the Code Daily

The spread sheet is several rows long, i'm looking for a macro that if it find CODE=Daily, in COLUMN C then the MARCO should change that Data in that row in column A by computers current date.

here is the link to formatted data and below is unformatted date

https://spreadsheets.google.com/spr...-1BKedGlfdkFMR1BuSF9GOU1uVko2VlEyU3c&hl=en_US


any help will be appreciated.

Thanks.


A B C
===== === =============
07/27/11 xx daily
07/27/11 x c=patrick and kimberly
07/27/11 x c=patrick and kimberly
07/27/11 xx daily, Archuleta Christopher R
07/29/11 x daily
07/29/11 xx dialy, debbie, QUESENBERRY,IRVIN WILLIAM FAMILY TRUST
07/27/11 x daily
07/27/11 x nirmala
07/27/11 x nirmala
07/30/11 x daily
07/30/11 xx daily
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Try:
Code:
Sub test()
For r = 1 To Range("C" & Rows.Count).End(xlUp).Row
If Mid(Range("C" & r), 1, 5) = "daily" Then
Range("A" & r) = Date
End If
Next
End Sub
 
Upvote 0
An alternate approach would be to use AutoFilter ..

<font face=Courier New><br><SPAN style="color:#00007F">Sub</SPAN> UpdateDate()<br>    Application.ScreenUpdating = <SPAN style="color:#00007F">False</SPAN><br>    Rows(1).Insert<br>    <SPAN style="color:#00007F">With</SPAN> Range("C1", Range("C" & Rows.Count).End(xlUp))<br>        .Cells(1, 1).Value = "tmp"<br>        .AutoFilter Field:=1, Criteria1:="=Daily"<br>        .Offset(, -2).SpecialCells(xlCellTypeVisible).Value = <SPAN style="color:#00007F">Date</SPAN><br>    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br>    Rows(1).Delete<br>    Application.ScreenUpdating = <SPAN style="color:#00007F">True</SPAN><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>
 
Upvote 0

Forum statistics

Threads
1,224,567
Messages
6,179,571
Members
452,927
Latest member
whitfieldcraig

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