Auto fill when you press enter key.

rapitorres

New Member
Joined
Oct 5, 2017
Messages
39
Office Version
  1. 2010
Platform
  1. Windows
HI!

I'm new here. I'm thinking if this is possible. example I enter "123" in cell A1. then I type something from B1, C1, D1, E1 and so on. and when I press enter key, automatically, A2 will display the top value which A1's value (123)? is this possible?



thank you so much!:laugh::laugh::laugh:
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
So you want the value from A1 to be copied down to A2 automatically? Is that right?
If so, exactly when should this happen? When you enter something in B2?
 
Upvote 0
HI SIR! :)

I want it to happen when i press the enter key. not by entering value from b1,c1 and so on. but by pressing ENTER KEY. :)
 
Upvote 0
OK, if you do not care which cell you hit the ENTER key on, the following code will run automatically upon the following conditions:
- A value is entered into any cell
- Cell A1 has a value
- Cell A2 does not have a value
Then it will copy A1 to A2.

This is Event Procedure code. To get it to run automatically, it must be placed in the proper sheet module.
To do this, right-click on the sheet tab name at the bottom of the screen, select "View Code", and paste this code in the resulting VB Editor window:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Range("A1") <> "" And Range("A2") = "" Then
        Application.EnableEvents=False
        Range("A2") = Range("A1")
        Application.EnableEvents=True
    End If
End Sub
 
Last edited:
Upvote 0
Hi sir Joe4 the code works well. I'm thinking if it is possible to do it in the whole worksheet like is it possible to assign only a cell that i want the procedure to happen?
 
Upvote 0
I'm thinking if it is possible to do it in the whole worksheet like is it possible to assign only a cell that i want the procedure to happen?
We can help you with that, but you need to give us more details of how you envision this working.
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,307
Members
452,633
Latest member
DougMo

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