Date stamping cell

rnewsome

New Member
Joined
Jul 6, 2010
Messages
22
I need a code to date stamp a cell in column M, if a cell on the same row in column G equals "x"...help?
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
If location G3 has an "x", following code will date stamp row 3 column M:
Code:
Sub DateStampCOL_M()
    Dim col_G, col_M, row_counter
        col_G = 7
        col_M = 13
        row_counter = 3
 
    If Cells(row_counter, col_G).Value = "x" Then
       Cells(row_counter, col_M) = Now() 'put current date and time in column M
       Cells(row_counter, col_M).Value = Cells(3, 13).Value 'replace now() with its value to stop clock there
    End If 
End Sub
 
Upvote 0
And this will loop through the top 10 rows:
Code:
Sub DateStampCOL_M()
 
    Dim col_G, col_M, row_counter, rows_max
        col_G = 7
        col_M = 13
        row_counter = 1
        rows_max = 10
 
    Do While row_counter <= rows_max
        If Cells(row_counter, col_G).Value = "x" Then 'if column G has an x
           Cells(row_counter, col_M) = Now() 'put current date and time in column M
           Cells(row_counter, col_M).Value = Cells(row_counter, col_M).Value 'replace now() with its value to stop clock there
        End If
        row_counter = row_counter + 1 'next row
    Loop
 
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,946
Latest member
JoseDavid

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