Tuesday, January 4, 2011

Shift Cell after enter data

This is the Excel VBA macro for me to shift from column one to column two after enter data, then from column two will switch to next row column one.

Basically column one is item code , we use bar code scanner , then column two will be number of quantity. After enter quantity , then the box will switch to next row and ready to read the next item.


Private Sub Worksheet_Change(ByVal Target As Range)

If ActiveCell.Column = 1 Then
ActiveCell.Offset(0, 1).Select
ElseIf ActiveCell.Column = 2 Then
ActiveCell.Offset(1, -1).Select
End If

End Sub



No comments:

Post a Comment

Feel free to leave your question or comment here, we will reply you as soon as possible.