Saltar al contenido
PROGRAMAR EN VBA MACROS DE EXCEL

Como Sumar Textbox en Tiempo Real o Simultaneamente #433

La macro que se presenta en este post tiene origen en una sugerencia de un suscriptor de nuestro canal de YouTube es una macro que suma textbox en tiempo real, simultáneamente o a medida que se ingresan números.

Desde el final del post se puede descargar el ejemplo en forma gratuita sin ninguna restricción, el código se puede adaptar a cada necesidad, Aporta por favor para sostener el sitio si está dentro de tus posibilidades, desde ya muchas gracias.

Si te estás iniciando en la operación de Excel o requieres afirmar conocimientos, recomiendo leer un excelente libro sobre Excel que te ayudará operar las planillas u hojas de cálculo, haz click acá, si quieres aprender sobre Excel, en inglés, entonces debes hacer click here. Si lo que necesitas es aprender o profundizar sobre la programación de macros con VBA este es unos de los mejores cursos on line que he visto en internet.

  
El vídeo verás la macro en acción con una explicación más detallada de su codificación y funcionamiento, recomiendo observar para una más fácil comprensión de la macro; suscribe a nuestra web desde la parte superior derecha de la página ingresando tu mail y a nuestro canal de You Tube para recibir en tu correo vídeos explicativos sobre macros interesantes, como  por ejemplo Recorre fila buscando y comparando datos de dos columnas en hojas distintasbuscar en listbox mientras escribes en textbox, como crear una factura o sale invoice y grabar guardar PDF XLS y enviar por mail, trabajando con filas, celdas, columnas, rangos y muchos ejemplos más.

 

La macro que se presenta es muy simple consiste en un formulario de Excel con varios textbox, que al ingresar un importe en el textbox, simultáneamente o en tiempo real va sumando los datos ingresados en otro textbox.

Al presionar el botón que está en el archivo de ejemplo se muestra un formulario con tres textbox donde se ingresan los datos y un cuarto textbox donde se van sumando automáticamente o en tiemporreal a medida que se ingresan los datos en los otros textbox.

⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛

Quizá sea de utilidad también

Como mostrar imagen animada en formulario Excel

Como agregar botón maximizar minimizar a formulario de Excel

Como buscar y cargar imagen de un catalogo en formulario Excel

⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛

⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛

Se debe dimensionar variables como tipo currency, son las variables t1, t2 y t3 que corresponde a los textbox1, textbox2 y textbox3

En el ejemplo se detecta si el dato ingresado es numérico, en ese caso, carga en las variables t1, t2 o t3 los respectivos datos de los textbox, a medida que se van ingresando los datos en estos textbox en el textbox4 en forma simultanea o tiempo real se van sumando los datos cargados en textbox.

Se debe tener presente que se debe agregar el código en el evento Change del textbox y en cada uno de los textbox sobre los cuales se desea sumar los datos ingresados en forma simultanea, en tiempo real o a medida que se escribe en textbox.

El código completo del ejemplo Como Sumar Textbox en Tiempo Real, se encuentra a continuación.

Código que se inserta en un Userform

Private Sub TextBox1_Change()
Dim t1 As Currency, t2 As Currency, t3 As Currency
On Error Resume Next
UserForm1.TextBox1 = Replace(UserForm1.TextBox1, «.», «,»)  ‘Si se usa . como separador decimal cambiar punto Replace(UserForm1.TextBox1, «,», «.»)
If IsNumeric(UserForm1.TextBox1) Then t1 = CDec(UserForm1.TextBox1)
If IsNumeric(UserForm1.TextBox2) Then t2 = CDec(UserForm1.TextBox2)
If IsNumeric(UserForm1.TextBox3) Then t3 = CDec(UserForm1.TextBox3)
UserForm1.TextBox4 = t1 + t2 + t3
End Sub

Private Sub TextBox2_Change()
Dim t1 As Currency, t2 As Currency, t3 As Currency
On Error Resume Next
UserForm1.TextBox2 = Replace(UserForm1.TextBox2, «.», «,»)  ‘Si se usa . como separador decimal cambiar punto Replace(UserForm1.TextBox2, «,», «.»)
If IsNumeric(UserForm1.TextBox1) Then t1 = CDec(UserForm1.TextBox1)
If IsNumeric(UserForm1.TextBox2) Then t2 = CDec(UserForm1.TextBox2)
If IsNumeric(UserForm1.TextBox3) Then t3 = CDec(UserForm1.TextBox3)
UserForm1.TextBox4 = t1 + t2 + t3
End Sub

Private Sub TextBox3_Change()
Dim t1 As Currency, t2 As Currency, t3 As Currency
On Error Resume Next
UserForm1.TextBox3 = Replace(UserForm1.TextBox3, «.», «,») ‘Si se usa . como separador decimal cambiar punto Replace(UserForm1.TextBox3, «,», «.»)
If IsNumeric(UserForm1.TextBox1) Then t1 = CDec(UserForm1.TextBox1)
If IsNumeric(UserForm1.TextBox2) Then t2 = CDec(UserForm1.TextBox2)
If IsNumeric(UserForm1.TextBox3) Then t3 = CDec(UserForm1.TextBox3)
UserForm1.TextBox4 = t1 + t2 + t3
End Sub

Código que se inserta en un módulo


Sub muestra()
UserForm1.Show
End Sub
⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛⇛

Si te fue de utilidad puedes INVITARME UN CAFÉ y de esta manera ayudar a seguir manteniendo la página, CLICK para descargar en ejemplo en forma gratuita.


(adsbygoogle = window.adsbygoogle || []).push({});

If this post was helpful INVITE ME A COFFEE and so help keep up the page, CLICK to download free example.

Si te gustó por favor compártelo con tus amigos
If you liked please share it with your friends

Entradas relacionadas

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Comentarios (82)

I am the manager of JustCBD label (justcbdstore.com) and am looking to broaden my wholesale side of business. I really hope that someone at targetdomain give me some advice 🙂 I considered that the best way to do this would be to reach out to vape stores and cbd stores. I was really hoping if anyone could recommend a trustworthy site where I can purchase Vape Shop Business Contact Details I am already considering creativebeartech.com, theeliquidboutique.co.uk and wowitloveithaveit.com. Not exactly sure which one would be the most ideal choice and would appreciate any guidance on this. Or would it be easier for me to scrape my own leads? Ideas?

Responder

Spot on with this write-up, I absolutely believe this web site needs far more attention. I’ll probably be back again to see more, thanks for the info!

Responder

Excellent site you have here.. It’s difficult to find good quality writing like yours nowadays. I really appreciate individuals like you! Take care!!

Responder

Your style is so unique in comparison to other folks I’ve read stuff from. I appreciate you for posting when you have the opportunity, Guess I will just book mark this web site.

Responder

May I simply just say what a relief to uncover somebody who really knows what they’re talking about over the internet. You definitely understand how to bring a problem to light and make it important. A lot more people must read this and understand this side of the story. I was surprised that you are not more popular because you definitely have the gift.

Responder

Spot on with this write-up, I really feel this amazing site needs far more attention. I’ll probably be returning to read more, thanks for the info!

Responder

This is a really good tip especially to those fresh to the blogosphere. Simple but very precise information… Thank you for sharing this one. A must read post!

Responder

Hello, I think your site might be having browser compatibility issues.

When I look at your blog in Chrome, it looks fine but when opening in Internet Explorer,
it has some overlapping. I just wanted to give you a quick heads up!
Other then that, superb blog! adreamoftrains webhosting

Responder

I just want to say I am newbie to blogs and really savored you’re web blog. More than likely I’m going to bookmark your website . You really have terrific well written articles. Thanks for sharing your web site.

Responder

I got this web page from my pal who shared with me regarding this web site and now this time I am visiting this site and reading
very informative articles or reviews at this time.

Responder

Thanks for sharing your info. I truly appreciate your efforts and I will be waiting for your next post thank you once again.

Responder

That is a very good tip particularly to those fresh to the blogosphere. Short but very accurate info… Thanks for sharing this one. A must read article!

Responder

Oh my goodness! Impressive article dude! Many thanks, However I am experiencing problems with your RSS. I don’t understand why I cannot subscribe to it. Is there anybody else getting identical RSS issues? Anybody who knows the answer will you kindly respond? Thanx!!

Responder

An intriguing discussion is definitely worth comment. There’s no doubt that that you need to publish more on this topic, it might not be a taboo matter but typically folks don’t speak about such subjects. To the next! All the best!!

Responder

Your style is really unique in comparison to other folks I’ve read stuff from. Thank you for posting when you’ve got the opportunity, Guess I’ll just bookmark this web site.

Responder

I’m curious to find out what blog system you have been utilizing?
I’m experiencing some minor security problems
with my latest site and I would like to find something more safe.
Do you have any solutions?

Responder

Achieving your fitness goal does not need a certified personal trainer or an expensive gym memberships, especially when you have the budget and the space to consider practically every workout machine on the market.

Responder

Way cool! Some very valid points! I appreciate you writing this post and the rest of the website is very good.

Responder

Oh my goodness! Awesome article dude! Thank you so much, However I am going through problems with your RSS. I don’t know why I am unable to join it. Is there anyone else having similar RSS issues? Anyone who knows the answer can you kindly respond? Thanx!!

Responder

I enjoy looking through an article that will make men and women think. Also, many thanks for allowing for me to comment!

Responder

Your style is so unique in comparison to other people I’ve read stuff from. Thank you for posting when you’ve got the opportunity, Guess I will just book mark this page.

Responder

Hello, every time i used to check weblog posts here early in the
daylight, for the reason that i enjoy to learn more and more.

Responder

Hi, I do believe this is a great blog. I stumbledupon it 😉 I am going to revisit once again since I book-marked it. Money and freedom is the best way to change, may you be rich and continue to guide others.

Responder

I used to be able to find good info from your blog articles.

Responder

Great post. I’m dealing with many of these issues as well..

Responder

It is the best time to make some plans for the future and it is time to be happy.
I have read this post and if I could I desire to suggest you few interesting things or advice.
Perhaps you can write next articles referring to this article.
I desire to read more things about it!

Responder

We tested coffee makers for the water temperature during the brew cycle and the brewing time as well as the temperature of the coffee at the end of brewing and during the keep warm cycle. In addition, we evaluated each brewer’s ease of use, including how easy it was to read and use the controls, access the water tank and brew basket, read the markings on the tank and carafe, whether or not it had automatic keep warm and shut off cycles, and the ease of cleaning the carafe.

Responder

This site really has all of the info I wanted concerning this subject and didn’t know who to ask.

Responder

You’ve made some decent points there. I looked on the web for more info about the issue and found most people will go along with your views on this web site.

Responder

I need to to thank you for this great read!! I definitely loved every bit of it. I have got you bookmarked to look at new things you post…

Responder

Pretty! This was a really wonderful post. Many thanks for supplying this info.

Responder

I really like it whenever people get together and share opinions. Great site, continue the good work!

Responder

I like what you guys tend to be up too. This type of clever
work and reporting! Keep up the excellent works
guys I’ve you guys to my personal blogroll.

Responder

Spot on with this write-up, I honestly think this website needs much more attention. I’ll probably be back again to see more, thanks for the info!

Responder

Pretty! This was an incredibly wonderful post. Thank you for supplying this info.

Responder

I really like looking through an article that will make men and women think. Also, thank you for allowing for me to comment!

Responder

This excellent website certainly has all of the information and facts I needed about this subject and didn’t know who to ask.

Responder

The next time I read a blog, Hopefully it doesn’t fail me as much as this one. After all, I know it was my choice to read, however I actually believed you would probably have something interesting to talk about. All I hear is a bunch of whining about something you could possibly fix if you were not too busy looking for attention.

Responder

I blog often and I genuinely thank you for your content. This article has really peaked my interest. I am going to book mark your blog and keep checking for new details about once per week. I opted in for your RSS feed too.

Responder

This is a topic that is close to my heart… Take care! Exactly where are your contact details though?

Responder

I would like to thank you for the efforts you’ve put in writing this site. I am hoping to see the same high-grade content by you in the future as well. In fact, your creative writing abilities has inspired me to get my own, personal website now 😉

Responder

When I initially left a comment I appear to have clicked the -Notify me when new comments are added- checkbox and now every time a comment is added I recieve 4 emails with the same comment. There has to be a means you can remove me from that service? Kudos!

Responder

That is a great tip especially to those new to the blogosphere. Simple but very accurate information… Many thanks for sharing this one. A must read article!

Responder

Please let me know if you’re looking for a writer for your weblog. You have some really good posts and I feel I would be a good asset. If you ever want to take some of the load off, I’d love to write some material for your blog in exchange for a link back to mine. Please shoot me an email if interested. Many thanks!

Responder

Hi there, I believe your website may be having browser compatibility problems. When I look at your web site in Safari, it looks fine but when opening in Internet Explorer, it’s got some overlapping issues. I just wanted to give you a quick heads up! Aside from that, great site!

Responder

I really love your site.. Pleasant colors & theme. Did you make this website yourself? Please reply back as I’m trying to create my own personal website and would like to know where you got this from or what the theme is called. Cheers!

Responder

May I simply just say what a relief to uncover somebody who genuinely knows what they are talking about over the internet. You actually know how to bring an issue to light and make it important. A lot more people need to check this out and understand this side of your story. I was surprised that you aren’t more popular because you most certainly have the gift.

Responder

This web site certainly has all the info I wanted concerning this subject and didn’t know who to ask.

Responder

Nice post. I learn something new and challenging on blogs I stumbleupon every day. It’s always interesting to read content from other writers and use a little something from their web sites.

Responder

Everything is very open with a really clear explanation of the issues. It was definitely informative. Your website is very helpful. Many thanks for sharing!

Responder

Hi there! I know this is kind of off topic but I was wondering if you knew where I could get a captcha plugin for my comment form? I’m using the same blog platform as yours and I’m having trouble finding one? Thanks a lot!

Responder

Everything is very open with a precise clarification of the issues. It was really informative. Your website is extremely helpful. Thank you for sharing!

Responder

bookmarked!!, I like your blog!

Responder

I was more than happy to uncover this web site. I wanted to thank you for your time for this particularly wonderful read!! I definitely loved every bit of it and i also have you bookmarked to see new stuff in your website.

Responder

Oh my goodness! Incredible article dude! Thank you so much, However I am experiencing problems with your RSS. I don’t know the reason why I cannot join it. Is there anyone else getting similar RSS problems? Anyone who knows the solution can you kindly respond? Thanx!!

Responder

Having read this I thought it was really informative. I appreciate you spending some time and effort to put this informative article together. I once again find myself personally spending a lot of time both reading and commenting. But so what, it was still worthwhile!

Responder

I used to be able to find good info from your articles.

Responder

I’m extremely pleased to uncover this website. I wanted to thank you for ones time for this wonderful read!! I definitely loved every part of it and I have you saved to fav to see new stuff on your website.

Responder

Hello, I do think your web site may be having browser compatibility problems. Whenever I take a look at your site in Safari, it looks fine however when opening in I.E., it’s got some overlapping issues. I just wanted to provide you with a quick heads up! Besides that, wonderful site!

Responder

Pretty! This has been a really wonderful post. Thanks for providing this info.

Responder

I used to be able to find good info from your blog articles.

Responder

I was able to find good info from your content.

Responder

I’m amazed, I must say. Rarely do I come across a blog that’s both educative and amusing, and without a doubt, you’ve hit the nail on the head. The issue is something too few men and women are speaking intelligently about. I’m very happy I came across this in my hunt for something concerning this.

Responder

You are so interesting! I do not suppose I have read something like this before. So great to find someone with original thoughts on this subject matter. Really.. thank you for starting this up. This site is something that’s needed on the web, someone with a bit of originality!

Responder

Everything is very open with a precise explanation of the challenges. It was truly informative. Your site is useful. Thanks for sharing!

Responder

There’s certainly a lot to learn about this issue. I like all the points you made.

Responder

I love reading through a post that will make men and women think. Also, thanks for allowing for me to comment!

Responder

Having read this I thought it was extremely enlightening. I appreciate you taking the time and energy to put this informative article together. I once again find myself spending a significant amount of time both reading and commenting. But so what, it was still worthwhile!

Responder

bookmarked!!, I like your online site!

Here is my website – MinnieAGamma

Responder

This is a great tip particularly to those new to the blogosphere. Short but very precise info… Appreciate your sharing this one. A must read post!

Responder

Howdy, I do believe your blog could possibly be having web browser compatibility issues. When I take a look at your website in Safari, it looks fine however when opening in Internet Explorer, it has some overlapping issues. I simply wanted to give you a quick heads up! Other than that, wonderful blog!

Responder

Good day! I could have sworn I’ve been to this website before but after browsing through many of the articles I realized it’s new to me. Anyhow, I’m certainly delighted I came across it and I’ll be book-marking it and checking back regularly!

Responder

Right here is the right webpage for anyone who would like to understand this topic. You know so much its almost tough to argue with you (not that I really will need to…HaHa). You certainly put a new spin on a subject which has been written about for a long time. Great stuff, just wonderful!

Responder

Nice post. I learn something totally new and challenging on sites I stumbleupon on a daily basis. It’s always exciting to read content from other writers and use something from other web sites.

Responder

I quite like reading an article that will make men and women think. Also, thank you for allowing for me to comment!

Responder

bookmarked!!, I really like your website!

Responder

Having read this I believed it was rather informative. I appreciate you taking the time and effort to put this informative article together. I once again find myself spending way too much time both reading and leaving comments. But so what, it was still worth it!

Responder

Hello! I could have sworn I’ve been to your blog before but after going through a few of the posts I realized it’s new to me. Regardless, I’m definitely pleased I stumbled upon it and I’ll be bookmarking it and checking back regularly!

Responder

I was able to find good information from your blog articles.

Responder

This web site definitely has all the information and facts I wanted about this subject and didn’t know who to ask.

Responder

The next time I read a blog, I hope that it won’t fail me as much as this particular one. I mean, Yes, it was my choice to read through, however I really believed you would probably have something interesting to say. All I hear is a bunch of moaning about something you could possibly fix if you weren’t too busy seeking attention.

Responder

Next time I read a blog, I hope that it does not disappoint me just as much as this particular one. I mean, I know it was my choice to read, nonetheless I truly believed you would probably have something useful to say. All I hear is a bunch of whining about something you could possibly fix if you weren’t too busy searching for attention.

Responder