Saltar al contenido
PROGRAMAR EN VBA MACROS DE EXCEL

Como CREAR una FACTURA o sale INVOICE NO Permitir FACTURAR con STOCK CERO en EXCEL VBA #11 #525

Factura en Excel - Facturar con Stock Cero

Factura de Venta Con Excel – Evitar Facturar si un Articulo tiene Stock Cero

En este post es otro complemento o mejora del aplicativo denominado como realizar una factura con Excel, lo que realiza el ejemplo es controlar si el producto que se requiere facturar tiene stock, en caso que el stock sea cero no deja facturar el articulo.

Existen muchos casos donde es conveniente o se permite facturar con stock cero, por ejemplo una empresa que envía productos que no son entregados en el momento al cliente y que justo cuando se facturar no tiene stock, pero que va a existir stock en el transcurso del día, porque el proveedor los va a abastecer; es necesario facturar con stock cero para no perder la venta.

De esta manera se comportaba este ejemplo que hemos denominado Factura en Venta en Excel, pero un suscriptor de nuestro canal de YouTube, nos plantea si es posible hacer que la macro no deje facturar si un artículo tiene stock cero, a lo cual le contestamos que si y este es el ejemplo que permite determinar si un articulo tiene stock cero en Excel, para permitir o no permitir facturar.

Requieres aprender a operar Excel, hazlo en forma fácil y sencilla, 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, te lo recomiendo no te arrepentirás.

  
 

Mira la macro en acción, 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 nuestro canal de You Tube, mira el playlist con  vídeos relacionados donde podrás ver la macros relacionadas en acción con una explicación en forma visual que ayudará a entender el ejemplo en forma más fácil.

Evitar facturar al Controlar el Stock en Excel en caso de ser Cero

El ejemplo lo que realiza es al momento de elegir el producto a facturar, controla que en la base de datos el stock sea distinto de cero, en ese caso procede a facturar dicho articulo, en caso contrario no se deja facturar con stock cero, saliendo un mensaje que avisa de ello.

Como se dijo la macro se encuentre en el Formulario1 y se ejecuta dicho control de stock en Excel una vez que el usuario seleccionó el producto a facturar.

Macro que evita facturar si el stock que hay en la base de datos de Excel es Cero

Una vez seleccionado el producto a facturar, la macro detecta cuando se presiona Enter y empieza a ejecutar la macro, se usa el código:

If KeyAscii = 13 Then

Luego como el Listbox1 del Formulario, al buscar los datos se carga en el Listbox el dato de cantidad, directamente se determina cual es el stock y se compara con cero, en caso de ser mayor a cero deja facturar caso contrario no deja facturar, saliendo un mensaje avisando tal situación y finalizando la macro.

En caso que ustedes ubiesen adaptado la macro y no tuviesen el la cantidad de stock en el formulario se debería proceder a buscar dicho dato en la base de datos.

De la siguiente manera se obtiene el dato, que es la cantidad de stock del producto seleccionado, luego se compara con cero, si es igual no deja facturar y concluye la macro utilizando «Exit Sub», el código es el siguiente:

st = ListBox1.List(fila, 6)
If st = 0 Then
Unload UserForm1
MsgBox («No existe stock del producto que desea facturar»), vbCritical, «https://macrosenexcel.com»
Exit Sub
End If

Si requieres ver el restos de vídeos de la saga como hacer una factura con Excel, click en el link para ver los vídeos anteriores «Como Crear una Factura en Excel Paso a Paso

 

Descarga el Libro usado para Como Ejemplo Crear Factura en Excel Paso a Paso

Puedes obtener el libro usado en este ejemplo, al finalizar el post se encuentra el respectivo link, el mismo es totalmente gratuito y su uso es libre, solicito aportar para sostener esta web, si está dentro de tus posibilidades, desde ya muchas gracias.

Código Formulario 1  Listbox1 del Ejemplo Como Crear Factura en Excel

Private Sub ListBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
On Error Resume Next
If KeyAscii = 13 Then
Set a = Sheets(«Articulos»)
filaedit = a.Range(«A» & Rows.Count).End(xlUp).Row
fila = Me.ListBox1.ListIndex

cod = ListBox1.List(fila, 1)
art = ListBox1.List(fila, 2)
mar = ListBox1.List(fila, 3)
pv = ListBox1.List(fila, 8)

st = ListBox1.List(fila, 6)
If st = 0 Then
Unload UserForm1
MsgBox («No existe stock del producto que desea facturar»), vbCritical, «https://macrosenexcel.com»
Exit Sub
End If


Set codigo = a.Range(«B2:B» & filaedit).Find(cod, LookIn:=xlValues, LookAt:=xlWhole)
If Not codigo Is Nothing Then
stodir = codigo.Row
End If

End If
Unload UserForm1
UserForm3.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.

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

Donate:
Cuenta Paypal: https://paypal.me/programarexcel
Cuenta Bitcoin: 1KBGGb8fyDzyR3X1Rie6m7VguzaAfngNbd
Cuenta Ether: 0x41Bbd24556914C83a31217eBb3BC49789b66e407

Summary
Author Rating
1star1star1star1star1star
Aggregate Rating
no rating based on 0 votes

Entradas relacionadas

Deja un comentario

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

Comentarios (34)

I am the business owner of JustCBD Store company (justcbdstore.com) and am seeking to expand my wholesale side of business. I really hope that anybody at targetdomain share some guidance ! I thought that the most ideal way to do this would be to connect to vape shops and cbd retail stores. I was hoping if anybody could suggest a dependable web-site where I can get Vape Shop B2B Mailing List I am already looking at creativebeartech.com, theeliquidboutique.co.uk and wowitloveithaveit.com. Not sure which one would be the most suitable option and would appreciate any guidance on this. Or would it be simpler for me to scrape my own leads? Suggestions?

Responder

Быстрый результат. читайте ответы юристов банкротство юридических лиц а так же ликвидация ооо с долгами

Responder

I blog quite often and I seriously appreciate your information. This great article has truly peaked my interest. I am going to book mark your website and keep checking for new details about once per week. I opted in for your RSS feed as well.

Responder

Good info. Lucky me I recently found your site by chance (stumbleupon). I have book marked it for later!

Responder

I wanted to thank you for this fantastic read!! I absolutely loved every little bit of it. I’ve got you book marked to look at new things you post…

Responder

This is the right webpage for anyone who really wants to find out about this topic. You understand a whole lot its almost tough to argue with you (not that I really would want to…HaHa). You definitely put a brand new spin on a topic that’s been written about for years. Wonderful stuff, just wonderful!

Responder

Way cool! Some very valid points! I appreciate you penning this article plus the rest of the website is also very good.

Responder

Spot on with this write-up, I absolutely think this amazing site needs a great deal more attention. I’ll probably be back again to see more, thanks for the info!

Responder

I really like it when individuals come together and share ideas. Great website, keep it up!

Responder

I couldn’t refrain from commenting. Very well written!

Responder

I must thank you for the efforts you’ve put in writing this site. I am hoping to view the same high-grade content from you later on as well. In truth, your creative writing abilities has inspired me to get my own blog now 😉

Responder

Good information. Lucky me I recently found your website by accident (stumbleupon). I’ve saved it for later!

Responder

Aw, this was an incredibly nice post. Taking a few minutes and actual effort to produce a really good article… but what can I say… I put things off a lot and don’t manage to get anything done.

Responder

Saved as a favorite, I really like your web site!

Responder

Hi there! I could have sworn I’ve visited your blog before but after browsing through a few of the articles I realized it’s new to me. Anyways, I’m certainly pleased I stumbled upon it and I’ll be book-marking it and checking back regularly!

Responder

Having read this I believed it was extremely informative. I appreciate you finding the time and energy to put this content together. I once again find myself spending a significant amount of time both reading and posting comments. But so what, it was still worthwhile!

Responder

I really love your website.. Great colors & theme. Did you develop this amazing site yourself? Please reply back as I’m planning to create my own blog and would like to find out where you got this from or just what the theme is named. Appreciate it!

Responder

Good information. Lucky me I discovered your site by chance (stumbleupon). I have book marked it for later!

Responder

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

Responder

I enjoy reading through an article that can make people think. Also, many thanks for allowing me to comment!

Responder

This is the right web site for anybody who would like to understand this topic. You understand a whole lot its almost tough to argue with you (not that I actually will need to…HaHa). You definitely put a new spin on a subject which has been written about for ages. Great stuff, just great!

Responder

I seriously love your website.. Great colors & theme. Did you create this web site yourself? Please reply back as I’m hoping to create my very own blog and would like to know where you got this from or what the theme is called. Thank you!

Responder

Right here is the perfect site for anybody who really wants to understand this topic. You understand so much its almost tough to argue with you (not that I personally would want to…HaHa). You definitely put a new spin on a subject which has been discussed for decades. Excellent stuff, just wonderful!

Responder

Touche. Solid arguments. Keep up the amazing work.

Responder

bookmarked!!, I really like your site!

Responder

Good day! I could have sworn I’ve visited this blog before but after looking at some of the articles I realized it’s new to me. Anyhow, I’m definitely pleased I found it and I’ll be book-marking it and checking back often!

Responder

The very next time I read a blog, Hopefully it doesn’t disappoint me as much as this one. I mean, I know it was my choice to read, but I truly thought you would probably have something useful to say. All I hear is a bunch of complaining about something you could fix if you were not too busy searching for attention.

Responder

Oh my goodness! Awesome article dude! Thanks, However I am having troubles with your RSS. I don’t understand why I am unable to join it. Is there anybody else getting the same RSS issues? Anyone that knows the answer will you kindly respond? Thanks!!

Responder

Next time I read a blog, Hopefully it won’t disappoint me just as much as this particular one. After all, Yes, it was my choice to read through, however I truly thought you’d have something useful to talk about. All I hear is a bunch of crying about something that you could fix if you were not too busy seeking attention.

Responder

I’m impressed, I must say. Rarely do I come across
a blog that’s both educative and interesting, and let me tell you, you have hit the nail on the head.

The issue is something which too few folks are speaking intelligently about.
Now i’m very happy that I came across this in my hunt for something regarding this.

adreamoftrains hosting services

Responder

Wow that was unusual. I just wrote an really long
comment but after I clicked submit my comment didn’t appear.
Grrrr… well I’m not writing all that over again. Anyways, just wanted to say excellent blog!

Responder

I am sure this post has touched all the internet visitors, its really
really nice article on building up new blog.

Responder

It’s in reality a great and helpful piece of
info. I’m happy that you just shared this helpful information with us.

Please keep us informed like this. Thanks for sharing.

Responder

This is a topic that’s close to my heart… Thank you! Exactly where are your contact details though?

Responder