Célula recebe dígito e passa pra proxima célula

doidoDmais

New Member
Joined
Nov 13, 2012
Messages
4
Bom dia Galera!

To precisando de um jeito onde que:


Tenho 7 células. Cada célula recebe um dígito apenas.


Gostaria que ao digitar o digito de uma célula, ele automaticamente pula pra proxima célula.


Célula A1 ao receber o digito, ele pula para a célula seguinte A2, sem precisar selecionar a proxima célula ou dar enter ou clicar em botão.


Isso tem jeito?

São dados bancários.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Good morning everyone!

To need a way where they:
I have 7 cells. Each cell receives only one digit.
I would like to enter the digit of a cell, it automatically jumps to next cell.
Cell A1 to receive the digit, it jumps to the next cell A2 without having to select the next cell or to enter or click button.
That's no way?
They are banking data.

I've never used a timer or len() condition in a VBA event changer, but this might be possible................
 
Upvote 0
I tried Sixth Sense's way, it works:

First dragdown a textbox control from the control toolbox.
then press Alt+F11.
In VBE insert the code below.
Then type any single character in the textbox. it will be entered in the first blank cell in Column A.

Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Range("A65536").End(xlUp).Offset(1, 0).Value = Chr(KeyAscii)
TextBox1.Value = ""
End Sub

No need to press enter.
Just enter numbers as fast as you can.
Tell me if you can beat excel. ie xcel misses few or one of you inputs. (Just Kidding)
Edit:
Forgot one thing! Exit design mode before you type anything on the
textbox.
 
Upvote 0
Bom dia,

Esqueci de falar que só preciso que 7 células funcione esse VBA, um do lado do outro. A1 vai B1 vai C1 ...

Cada célula recebe apenas 1 dígito e vai pra próxima célula.

E é na própria célula da planilha e não em uma caixa de texto.
 
Upvote 0
Não falo português. Mas eu falo espanhol. Espero que você será capaz de entender o meu espanhol.
La cosa es que no se puede hacer lo que usted está pidiendo. Una vez de que uno empieza a teclar datos dentro de una celda, Excel ya no reponde a eventos hasta que uno registra la fórmula con ENTER o CTRL+ENTER o CTRL+SHIFT+ENTER. Mientras Excel está en modo de editar (edit mode) nada de VBA corre.
La solución que nos ofrece Sixth Sense aproveche del hecho de que un control ActiveX sí corre VBA mientras uno está editando dentro de la caja y así podemos hacer algo bastante parecido a lo que usted desea.
Favor note que el código se coloca en el módulo de la hoja que tiene la caja de texto y no en un módulo normal.

<font face=Calibri><SPAN style="color:#00007F">Private</SPAN> m_celTarget <SPAN style="color:#00007F">As</SPAN> Excel.Range<br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_KeyPress(<SPAN style="color:#00007F">ByVal</SPAN> KeyAscii As MSForms.ReturnInteger)<br><br>        <br>    <SPAN style="color:#00007F">If</SPAN> m_celTarget <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> <SPAN style="color:#00007F">Then</SPAN><br>    <br>        <SPAN style="color:#00007F">If</SPAN> ActiveCell.Column > 7 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br>        <br>        <SPAN style="color:#00007F">Set</SPAN> m_celTarget = ActiveCell<br>        <br>        <SPAN style="color:#00007F">Set</SPAN> m_celTarget = Range("A" & Rows.Count).End(xlUp)<br>        <SPAN style="color:#00007F">Set</SPAN> m_celTarget = Cells(m_celTarget.Row, Columns.Count).End(xlToLeft)<br>        <br>        <SPAN style="color:#00007F">If</SPAN> Len(m_celTarget.Value) <> 0 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(, 1)<br>        <br>        <SPAN style="color:#00007F">If</SPAN> m_celTarget.Column = 7 <SPAN style="color:#00007F">Then</SPAN><br>            <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(1, -6)<br>        <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br>        <br>    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br>    <br>    m_celTarget.Value = Chr(KeyAscii)<br>    <br>    TextBox1.Text = ""<br>        <br>    <SPAN style="color:#00007F">If</SPAN> m_celTarget.Column = 7 <SPAN style="color:#00007F">Then</SPAN><br>        <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(1, -6)<br>    <SPAN style="color:#00007F">Else</SPAN><br>        <SPAN style="color:#00007F">Set</SPAN> m_celTarget = m_celTarget.Offset(, 1)<br>    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br>    <br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_LostFocus()<br><br>    TextBox1.Text = ""<br>    <SPAN style="color:#00007F">Set</SPAN> m_celTarget = <SPAN style="color:#00007F">Nothing</SPAN><br><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>
 
Last edited:
Upvote 0
Nesse caso então, vou ver se a caixa de texto será funcional para o trabalho que preciso.

Obrigado pela ajuda.
 
Upvote 0

Forum statistics

Threads
1,223,948
Messages
6,175,575
Members
452,652
Latest member
eduedu

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