• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Inserting new data in same row using a criteria

tazz

Member
Hello all,
Since this post was started a couple of day ago in the old forum I decided to bring it back in this one.
This code(thanks to coolkiran) is inserting computer's time in all cells belonging to column C for the same IDnumber as in Col A. I would like to change this code to insert computer's time only in one cell near the cell in col B with the most recent time for the same IDnumber as in col A.

To be more specific :
-col A is IDnumber, col B is Time IN and col C is Time Out
-TextBox1 is used for inserting IDnumber in the spread sheet.

Sheets("Yoursheetname").Activate
'Dim rw As Long 'next available row
Cells(Rows.Count, "A").Select
Selection.End(xlUp).Select
BotRow = Selection.Row
For rw = 1 To BotRow
If Cells(rw, "A").Value = TextBox1.Text Then 'Personal Id textbox
Cells(rw, "c").Value = Now()
End If
Next

Thank you for your help.
 
Try this one..

Code:
Sub test()
    With Range("A1").CurrentRegion
        .AutoFilter 1, "One"
        .Columns(1).SpecialCells(12).Offset(, 1) = Time()
        .AutoFilter
    End With
End Sub
 
Debraj, thank you for your post.
I tried your code and is not changing or adding anything to the spread sheet.
The code that I posted above is attached to a cmdbutton.
Where should I put yours?
 
Back
Top