You are here:

Excel/moving cell data automatically


Hello, I want to move the data in a cell to the next row automatically

I have 3 columns A,B,C, now if I enter the some data in A,B,C they should move to the next row (of same columns) and as I enter new values, the most frequent one must remain at the top. just like in a form

here is an example
A     B      C
say i enter 4 3 2 in 1st row of A, B, C
they should move to the 2nd row,
4 3 2
. . .
4 3 2

again if i enter 5, 6, 7 in the 1st row, this data should move to the 2nd row and the data in 2nd row, being the old one, must move to 3rd row and so on.
. . .
5 6 7
4 3 2

you can say the first row acts as a text field only for entering data, and the most latest data should remain at top.

Can it be done..
Thank you for your time

Sure, but the exact working depends on what you need. Lets say the code will be triggered as soon as all three cells contain a value.

Right-click the worksheet tab and select View Code. Paste this code into the window:

Option Explicit

Dim mbNoEvent As Boolean

Private Sub Worksheet_Change(ByVal Target As Range)
   If mbNoEvent Then Exit Sub
   If Intersect(Me.Range("A1:C1"), Target) Is Nothing Then Exit Sub
   If Len(Range("A1").Value) = 0 Then Exit Sub
   If Len(Range("B1").Value) = 0 Then Exit Sub
   If Len(Range("C1").Value) = 0 Then Exit Sub
   mbNoEvent = True
   mbNoEvent = False
End Sub

About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Jan Karel Pieterse


Excel and Excel/VBA questions


Excel MVP

Self employed Excel developer

Bachelor in Chemical Engineering

Awards and Honors
Microsoft MVP award since 2002

Past/Present Clients
Shell, Fortis bank, ABN-AMRO bank, Morgan Stanley, ...

©2017 All rights reserved.