Move to first cell in next row after data entry in other cell

emrfnl

New Member
Joined
Jan 17, 2016
Messages
34
Hi,

I am trying to make small improvement in data entry that i have to do almost every day.
Every time when new entry is made I need to capture exact time of that data entry.

What I have for now is file with vba code that is filling cells in column C with actual date and time every time when cell in column B is filled with some data. (if cell in column B is blank than C is also blank)

Code look like this:
Code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    Dim rCell As Range
    Dim rChange As Range
    
    On Error GoTo ErrHandler
    Set rChange = Intersect(Target, Range("B:B"))
    If Not rChange Is Nothing Then
        Application.EnableEvents = False
        For Each rCell In rChange
            If rCell > "" Then
                With rCell.Offset(0, 1)
                    .Value = Now
                    .NumberFormat = "mm/dd/yyyy hh:mm:ss"
                End With
            Else
                rCell.Offset(0, 1).Clear
            End If
        Next
    End If
ExitHandler:
    Set rCell = Nothing
    Set rChange = Nothing
    Application.EnableEvents = True
    Exit Sub
ErrHandler:
    MsgBox Err.Description
    Resume ExitHandler
End Sub


I will use barcode scanner to make data entry in columns "A" and "B", scanner is setup to put TAB after every scan so every time it is moving to the cell on the right side.
But when data in column"B" is entered with scanner so time is shown in column "C" and cell in column "C" is selected i would like to move to next row and select cell in column "A" so I can start entering data in new row.

Can you advice how this move can be done? Every help will be highly appriciated.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
It looks like rCell is in column B on any row. So to move down to column A of the next row, use:
Code:
rCell.Offset(1,-1).Select

Note the structure of Offset:
Code:
Offset(row, column)
So you want to move one row down, and one column to the left (backwards, hence the -1).
 
Upvote 0
Joe4 thank you.
Indeed basically every time when data in column B are entered I want to move to begining of next row.
Can you maybe help me how to add this offset function in to sheet so it can run all the time in the background?
 
Upvote 0

Forum statistics

Threads
1,215,737
Messages
6,126,576
Members
449,318
Latest member
Son Raphon

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