Macro that presses Enter key on active cell

omairhe

Well-known Member
Joined
Mar 26, 2009
Messages
1,961
Office Version
  1. 2019
Platform
  1. Windows
if the active cell is T3... what code that would work exactly like a Enter key is pressed on T3...Not looking for ActiveCell.Offset(0, 1).Range("A1").Select


any help will be appreciated.
thank you.
 

Some videos you may like

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Why do you need to do that? Pressing the Enter key while a cell is active has no effect.
 

omairhe

Well-known Member
Joined
Mar 26, 2009
Messages
1,961
Office Version
  1. 2019
Platform
  1. Windows
the cell moves to the adjacent cell. but u might think y not just use ActiveCell.Offset(0, 1).Range("A1").Select

the cell adjacent is not a regular cell but has a combo box inside of it via code.

and combo box only is active when i click or press Enter or Move arrow key on combo box cell. but if i do the same with macro it just moves to the underneth cell and doesn't select the combo box which usually gets selected if not use macro.

hope its clear... :)
 

omairhe

Well-known Member
Joined
Mar 26, 2009
Messages
1,961
Office Version
  1. 2019
Platform
  1. Windows
U3 has combo box and T3 is adjacent.... pressing right arrow key or Enter key from T3 moves to U3 and selects the combo box... offset macro selects only U3 Cell not the combo box that is inside U3...

will appreciate help
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
That's only true if the "Move selection after Enter" option is checked.

You could try:

SendKeys "{Enter}"

If that doesn't work what is the name of your ComboBox and where is it from (Control Toolbox or Forms Toolbar)?
 

omairhe

Well-known Member
Joined
Mar 26, 2009
Messages
1,961
Office Version
  1. 2019
Platform
  1. Windows
That's only true if the "Move selection after Enter" option is checked.

You could try:

SendKeys "{Enter}"

If that doesn't work what is the name of your ComboBox and where is it from (Control Toolbox or Forms Toolbar)?

My combobox is an Active X Controls from excel 2007 and your code worked :)

THanks Sir.
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,122,842
Messages
5,598,396
Members
414,235
Latest member
sucosama

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
Top