Saltar al contenido
PROGRAMAR EN VBA MACROS DE EXCEL

Macro VBA copia registro dependiendo de criterios

 Procedimiento de VBA para Excel, me preguntaron como se podía hacer para exportar datos de una hoja a otra, donde sólo se debían copiar ciertos datos y que cumplan varios criterios; bien eso es lo que hace este ejemplo mediante una Macro. Primero determina si los registros que se encuentran en la fila analizada se deben o no exportar, en caso afirmativo revisa si los datos de determinadas columnas cumplen un requisito, en caso positivo se copia esa columna, en caso negativo otra columna distinta, a su vez copia otra serie de registros que sólo dependen del primer criterio; haz click en el link del final para bajar el ejemplo. Te recomiendo que leas un excelente libro sobre Excel para ello haz click acá. El código que se encuentra a continuación se debe ingresar en un módulo, descargando el ejemplo lo podrás ver en funcionamiento, analizar, modificar y adaptar a lo que tú estés realizando el código está abierto sin ningún tipo de restricción.

Código a insertar en módulo

Sub exporta()
Application.ScreenUpdating = False
On Error Resume Next
Dim filaex, filaim, conta As Integer
filaex = 6
filaim = 2
conta = 0
While Sheets(«Libro»).Cells(filaex, 1) <> Empty
    If Sheets(«Libro»).Cells(filaex, 27) = «SI» Then
        Sheets(«Caja Diaria»).Cells(filaim, 1) = Sheets(«Libro»).Cells(filaex, 1)
        Sheets(«Caja Diaria»).Cells(filaim, 2) = Sheets(«Libro»).Cells(filaex, 2)
        Sheets(«Caja Diaria»).Cells(filaim, 3) = Sheets(«Libro»).Cells(filaex, 3)
        Sheets(«Caja Diaria»).Cells(filaim, 4) = Sheets(«Libro»).Cells(filaex, 6)
       
          If Sheets(«Libro»).Cells(filaex, 7) > 0 Then
                Sheets(«Caja Diaria»).Cells(filaim, 5) = Sheets(«Libro»).Cells(filaex, 7)
          Else
                Sheets(«Caja Diaria»).Cells(filaim, 5) = Sheets(«Libro»).Cells(filaex, 23)
          End If
         
          If Sheets(«Libro»).Cells(filaex, 8) > 0 Then
                Sheets(«Caja Diaria»).Cells(filaim, 6) = Sheets(«Libro»).Cells(filaex, 8)
          Else
                Sheets(«Caja Diaria»).Cells(filaim, 6) = Sheets(«Libro»).Cells(filaex, 24)
          End If
    conta = conta + 1
    filaim = filaim + 1
    End If
filaex = filaex + 1
Wend
MsgBox («Se exportaron con éxito » & conta & » registros»), vbInformation
Application.ScreenUpdating = False
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 (123)

I’m the business owner of JustCBD label (justcbdstore.com) and I am currently planning to grow my wholesale side of business. It would be great if anybody at targetdomain share some guidance . I thought that the most suitable way to accomplish this would be to connect to vape companies and cbd stores. I was hoping if anyone could suggest a dependable site where I can buy Vape Shop B2B Sales Leads I am presently checking out creativebeartech.com, theeliquidboutique.co.uk and wowitloveithaveit.com. Not sure which one would be the very best solution and would appreciate any guidance on this. Or would it be simpler for me to scrape my own leads? Suggestions?

Responder

I needed to thank you for this fantastic read!! I certainly enjoyed every little bit of it. I have you saved as a favorite to check out new stuff you post…

Responder

Great article. I’m experiencing a few of these issues as well..

Responder

Pretty! This has been an extremely wonderful post. Many thanks for providing these details.

Responder

You are so cool! I do not suppose I have read through anything like this before. So nice to find someone with unique thoughts on this topic. Really.. many thanks for starting this up. This web site is something that’s needed on the internet, someone with some originality!

Responder

Greetings from Idaho! I’m bored at work so I decided to check out your site on my iphone during lunch break.
I enjoy the knowledge you present here and can’t wait to take a look when I get
home. I’m surprised at how fast your blog loaded on my cell phone ..
I’m not even using WIFI, just 3G .. Anyways, amazing site!
adreamoftrains web hosting services

Responder

Hello! Someone in my Myspace group shared this website with us so I came
to check it out. I’m definitely enjoying the information. I’m book-marking
and will be tweeting this to my followers! Excellent blog and terrific design and style.

Responder

I simply want to tell you that I’m very new to blogging and seriously savored you’re web-site. Likely I’m want to bookmark your website . You absolutely have incredible posts. Thanks a bunch for revealing your webpage.

Responder

That is a good tip especially to those new to the blogosphere.
Simple but very accurate info… Appreciate your sharing this one.

A must read article!

Responder

I simply want to say I am all new to blogging and honestly liked your page. Very likely I’m want to bookmark your website . You certainly have amazing articles and reviews. Regards for sharing your website page.

Responder

Saved as a favorite, I like your web site!

Responder

You made some really good points there. I looked on the net for more info about the issue and found most individuals will go along with your views on this website.

Responder

This internet site is actually a walk-through for every one of the information you wanted about this as well as didn?t recognize that to ask. Glimpse here, and also you?ll certainly discover it.

Responder

Your style is unique compared to other people I have read stuff from. I appreciate you for posting when you’ve got the opportunity, Guess I will just bookmark this site.

Responder

This is a topic which is close to my heart… Cheers! Where are your contact details though?

Responder

Next time I read a blog, I hope that it doesn’t disappoint me just as much as this one. I mean, I know it was my choice to read through, but I actually thought you would have something useful to say. All I hear is a bunch of crying about something that you could possibly fix if you weren’t too busy looking for attention.

Responder

There is certainly a great deal to know about this topic. I really like all the points you have made.

Responder

Good blog post. I absolutely appreciate this website. Continue the good work!

Responder

pitkävetovihjeet

Responder

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

Responder

Aw, this was an exceptionally nice post. Finding the time and actual effort to generate a really good article… but what can I say… I put things off a whole lot and never manage to get nearly anything done.

Responder

Hello there! I could have sworn I’ve been to this site before but after looking at some of the articles I realized it’s new to me. Anyways, I’m definitely happy I came across it and I’ll be bookmarking it and checking back often!

Responder

For most recent information you have to go to see web and on internet I found this site as a finest web site for
hottest updates. 31muvXS cheap flights

Responder

“Parrilli is outrageously gifted with unstoppable creativity”

Responder

You ought to take part in a contest for one of the highest quality websites on the web. I’m going to recommend this web site!

Responder

Useful info. Fortunate me I discovered your web site accidentally, and
I’m surprised why this coincidence didn’t took place in advance!
I bookmarked it.

Responder

Good article. I certainly appreciate this site. Stick with it!

Responder

Oh my goodness! an impressive post man. Thanks Nonetheless I am experiencing issue with ur rss. Don?t know why Incapable to sign up for it. Is there anyone getting identical rss trouble? Any individual that understands kindly react. Thnkx

Responder

Next time I read a blog, I hope that it doesn’t fail me as much as this particular one. After all, Yes, it was my choice to read through, but I actually thought you would probably have something interesting to talk about. All I hear is a bunch of crying about something that you can fix if you weren’t too busy seeking attention.

Responder

I love what you guys are usually up too. This kind of clever work and coverage!
Keep up the wonderful works guys I’ve added you guys
to my own blogroll.

Responder

I?d need to consult you here. Which is not something I generally do! I appreciate checking out an article that will make people assume. Additionally, thanks for enabling me to comment!

Responder

When I initially left a comment I appear to have clicked the -Notify me when new comments are added- checkbox and from now on whenever a comment is added I receive 4 emails with the exact same comment. Is there an easy method you can remove me from that service? Thank you!

Responder

Your place is valueble for me. Thanks !?

Responder

I needed to thank you for this wonderful read!! I certainly loved every little bit of it. I’ve got you bookmarked to look at new stuff you post…

Responder

Aw, this was an extremely nice post. Finding the time and actual effort to produce a great article… but what can I say… I put things off a whole lot and never manage to get anything done.

Responder

There’s certainly a great deal to know about this subject. I really like all of the points you made.

Responder

How does Ibogaine cure addiction

Responder

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

Responder

I seriously love your website.. Very nice colors & theme. Did you build this site yourself? Please reply back as I’m wanting to create my very own site and want to find out where you got this from or exactly what the theme is named. Appreciate it!

Responder

Hi, I would like to subscribe for this blog to take most up-to-date updates, therefore where can i do it please help.

Responder

This is the right web site for everyone who really wants to find out about this topic. You understand so much its almost tough to argue with you (not that I actually will need to…HaHa). You certainly put a new spin on a subject which has been written about for years. Excellent stuff, just excellent!

Responder

Great article. I will be going through a few of these issues as well..

Responder

Best view i have ever seen !

Responder

I was really happy to find this web-site. I intended to many thanks for your time for this wonderful read!! I absolutely delighting in every bit of it and I have you bookmarked to have a look at new things you blog post.

Responder

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

Responder

Love watching sunset !

Responder

Love watching sunset !

Responder

May I simply just say what a relief to find somebody that truly understands what they are talking about online. You actually know how to bring an issue to light and make it important. A lot more people really need to check this out and understand this side of the story. I can’t believe you are not more popular since you definitely have the gift.

Responder

I really like it when folks get together and share views. Great site, stick with it!

Responder

May I just say what a relief to discover an individual who genuinely knows what they are talking about on the net. You actually realize how to bring a problem to light and make it important. More and more people must check this out and understand this side of your story. It’s surprising you are not more popular given that you most certainly have the gift.

Responder

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

Responder

Love watching sunset !

Responder

This blog was… how do you say it? Relevant!! Finally I have found something that helped me. Many thanks!

Responder

Best view i have ever seen !

Responder

Oh my goodness! Impressive article dude! Thanks, However I am encountering problems with your RSS. I don’t know why I am unable to subscribe to it. Is there anyone else having similar RSS issues? Anybody who knows the solution will you kindly respond? Thanx!!

Responder

Hmm it looks like your site ate my first comment (it was extremely long) so I guess I’ll just sum it up what I submitted and say, I’m thoroughly enjoying your blog. I as well am an aspiring blog writer but I’m still new to everything. Do you have any tips for rookie blog writers? I’d really appreciate it.

Responder

Excellent article. I’m dealing with some of these issues as well..

Responder

There is certainly a great deal to know about this issue. I really like all of the points you have made.

Responder

Can I simply state what an alleviation to find a person who in fact knows what theyre talking about on the web. You definitely understand how to bring a problem to light as well as make it essential. Even more individuals require to read this as well as recognize this side of the tale. I angle believe youre not more prominent because you most definitely have the gift.

Responder

ilmaiset videot, ilmaiset pornovideot, ilmaiset porno videot, porno video, porno videot

Responder

We’re a gaggle of volunteers and opening a brand new scheme in our community. Your website provided us with useful info to paintings on. You have performed a formidable task and our whole community can be grateful to you.

Responder

Greetings! Very useful advice in this particular post! It is the little changes that will make the greatest changes. Thanks for sharing!

Responder

I have to thank you for the efforts you’ve put in writing this site. I’m hoping to view the same high-grade blog posts from you in the future as well. In truth, your creative writing abilities has motivated me to get my own blog now 😉

Responder

Aw, this was an extremely nice post. Spending some time and actual effort to produce a good article… but what can I say… I hesitate a whole lot and don’t manage to get anything done.

Responder

There are some interesting closing dates on this article but I dont know if I see all of them heart to heart. There is some validity however I’ll take hold opinion till I look into it further. Good article , thanks and we wish extra! Added to FeedBurner as nicely

Responder

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

Responder

cbd oil

Responder

Oh my goodness! Amazing article dude! Thank you so much, However I am experiencing issues with your RSS. I don’t understand why I can’t join it. Is there anybody getting similar RSS issues? Anyone who knows the answer can you kindly respond? Thanks!!

Responder

There are definitely a lot of details like that to think about. That is a terrific point to bring up. I provide the ideas over as basic motivation but clearly there are inquiries like the one you bring up where one of the most vital point will certainly be operating in sincere good faith. I don?t recognize if best methods have actually arised around things like that, but I make sure that your job is plainly determined as an up for grabs. Both children and ladies really feel the influence of just a moment?s pleasure, for the rest of their lives.

Responder

I’m very pleased to discover this site. I want to to thank you for ones time due to this fantastic read!! I definitely loved every little bit of it and I have you saved to fav to check out new stuff in your web site.

Responder

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

Responder

Whatís Happening i am new to this, I stumbled upon this I’ve found It absolutely helpful and it has helped me out loads. I hope to contribute & aid other users like its helped me. Great job.

Responder

I want to to thank you for this very good read!! I certainly loved every bit of it. I have you saved as a favorite to check out new stuff you post…

Responder

It’s hard to come by well-informed people for this subject, but you sound like you know what you’re talking about! Thanks

Responder

This is a topic that’s near to my heart… Take care! Exactly whereare your contact details though?

Responder

The following time I check out a blog, I really hope that it does not dissatisfy me as high as this. I imply, I know it was my choice to check out, yet I actually thought youd have something fascinating to state. All I hear is a lot of whimpering about something that you could take care of if you werent also active searching for interest.

Responder

You are so awesome! I don’t suppose I’ve read through something like that before. So great to find someone with genuine thoughts on this subject. Really.. thank you for starting this up. This web site is something that is required on the internet, someone with a little originality!

Responder

May I simply just say what a relief to find an individual who actually knows what they’re talking about on the internet. You actually understand how to bring an issue to light and make it important. More and more people really need to look at this and understand this side of your story. I was surprised that you aren’t more popular since you definitely possess the gift.

Responder

Merely wanna comment that you have a very decent internet site , I love the design it really stands out.

Responder

There is certainly a great deal to learn about this issue. I love all the points you’ve made.

Responder

Hey, I think your site might be having browser compatibility issues. When I look at your blog in Safari, 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, excellent blog!

Responder

I was looking through some of your articles on this website and I conceive this site is rattling instructive! Retain putting up.

Responder

There is significantly a package to understand about this. I assume you ensured wonderful factors in attributes likewise.

Responder

Good site you’ve got here.. It’s hard to find high quality writing like yours nowadays. I seriously appreciate individuals like you! Take care!!

Responder

Hi! I could have sworn I’ve visited this site before but after browsing through some of the articles I realized it’s new to me. Nonetheless, I’m definitely delighted I found it and I’ll be bookmarking it and checking back frequently!

Responder

Nice read, I just passed this onto a friend who was doing a little research on that. And he actually bought me lunch since I found it for him smile Therefore let me rephrase that: Thanks for lunch!

Responder

It’s nearly impossible to find educated people on this topic, but you seem like you know what you’re talking about! Thanks

Responder

There are some interesting times in this article but I don?t understand if I see every one of them center to heart. There is some legitimacy but I will take hold viewpoint up until I consider it further. Good article, thanks as well as we want much more! Added to FeedBurner too

Responder

Howdy! I just wish to offer you a big thumbs up for your excellent info you have got right here on this post. I am coming back to your blog for more soon.

Responder

Good post. I learn something totally new and challenging on blogs I stumbleupon every day. It will always be exciting to read through articles from other authors and use a little something from other sites.

Responder

I was suggested this website by way of my cousin. I am no longer certain whether this post is written by him as nobody else understand such detailed approximately my problem. You are amazing! Thank you!

Responder

Next time I read a blog, Hopefully it does not disappoint me as much as this one. After all, Yes, it was my choice to read, but I genuinely thought you would have something helpful to talk about. All I hear is a bunch of complaining about something you could fix if you were not too busy looking for attention.

Responder

One important issue is that if you find yourself searching for a education loan you may find that you’ll need a co-signer. There are many scenarios where this is correct because you should find that you do not employ a past credit rating so the mortgage lender will require that you’ve got someone cosign the loan for you. Interesting post.

Responder

Hey I am so excited I found your weblog, I really found you by accident, while I was researching on Aol for something else, Nonetheless I am here now and would just like to say kudos for a incredible post and a all round exciting blog (I also love the theme/design), I dont have time to look over it all at the moment but I have book-marked it and also added your RSS feeds, so when I have time I will be back to read a great deal more, Please do keep up the excellent work.

Responder

My spouse and I absolutely love your blog and find almost all of your post’s to be just what I’m looking for. can you offer guest writers to write content for yourself? I wouldn’t mind composing a post or elaborating on some of the subjects you write in relation to here. Again, awesome weblog!

Responder

Your place is valueble for me. Many thanks !?

Responder

It’s difficult to find knowledgeable people on this subject, but you sound like you know what you’re talking about! Thanks

Responder

Aw, this was an extremely nice post. Finding the time and actual effort to make a top notch article… but what can I say… I put things off a lot and never seem to get anything done.

Responder

Oh my goodness! Amazing article dude! Thanks, However I am going through difficulties with your RSS. I don’t know why I am unable to join it. Is there anybody else getting identical RSS issues? Anybody who knows the solution will you kindly respond? Thanks!!

Responder

You made some respectable factors there. I regarded on the web for the difficulty and located most individuals will go together with together with your website.

Responder

This blog was… how do I say it? Relevant!! Finally I’ve found something that helped me. Thanks!

Responder

I couldn’t resist commenting. Perfectly written!

Responder

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

Responder

You should participate in a contest for among the most effective blog sites on the web. I will certainly advise this site!

Responder

custom essay org [url=https://customessayjojo.com/]custom written essay[/url] quality custom essays custom english essays custom essay meister review

Responder

write my essay today [url=https://essayonlinehdb.com/]custom essays for cheap[/url] cheap essays custom essay toronto best article writing service

Responder

I absolutely love your site.. Excellent colors & theme. Did you develop this website yourself? Please reply back as I’m attempting to create my very own blog and would love to learn where you got this from or exactly what the theme is called. Cheers!

Responder

It’s hard to come by well-informed people about this subject, however, you sound like you know what you’re talking about! Thanks

Responder

Excellent blog here! Also your website rather a lot up fast! What web host are you the usage of? Can I am getting your associate link for your host? I wish my site loaded up as fast as yours lol

Responder

essay homework help online [url=https://essayhelptopp.com/]student essay help[/url] national junior honor society essay help essay helper app essay helper online

Responder

essay writer software [url=https://essaywriterdodo.com/]cheap essay writers[/url] cheap essay writer your essay writer essay writer reddit

Responder

dissertation writing assistance [url=https://dissertationaas.com/]dissertation writing assistance[/url] dissertation writing services dissertation assistance writing dissertation statistics

Responder

Hi there, There’s no doubt that your web site could possibly be having web browser compatibility issues. Whenever I take a look at your site in Safari, it looks fine however, when opening in I.E., it has some overlapping issues. I simply wanted to provide you with a quick heads up! Besides that, wonderful site!

Responder

Thanks for your suggestions. One thing I have noticed is banks and also financial institutions know the dimensions and spending behavior of consumers and as well understand that many people max out their credit cards around the getaways. They wisely take advantage of that fact and start flooding ones inbox and snail-mail box by using hundreds of no-interest APR credit cards offers immediately after the holiday season comes to an end. Knowing that when you are like 98 of the American community, you’ll soar at the one opportunity to consolidate credit card debt and transfer balances towards 0 rate credit cards.

Responder

best payday loans online [url=https://ausapaydayloans.com/]most trusted payday loans online[/url] payday loans bad credit payday loans las vegas bad credit payday loans guaranteed approval

Responder

Thanks for your tips. One thing really noticed is banks and financial institutions have in mind the spending behaviors of consumers and understand that most people max out there their real credit cards around the breaks. They prudently take advantage of this particular fact and commence flooding a person’s inbox along with snail-mail box along with hundreds of 0 APR credit cards offers shortly when the holiday season ends. Knowing that should you be like 98 of all American general public, you’ll soar at the possiblity to consolidate card debt and switch balances for 0 APR credit cards.

Responder

best online payday loans [url=https://sapaydayiloans.com/]online payday loans direct lenders[/url] payday loans oregon most trusted payday loans online guaranteed payday loans

Responder

Hey there! I simply want to offer you a big thumbs up for the excellent information you’ve got here on this post. I am returning to your web site for more soon.

Responder

I think you have mentioned some very interesting points , thankyou for the post.

Responder

I do accept as true with all of the ideas you have offered for your post. They are really convincing and can definitely work. Nonetheless, the posts are too quick for starters. May you please lengthen them a bit from next time? Thank you for the post.

Responder

cialis online pharmacy [url=http://50cialmen.com/]online cialis[/url] tadalafil cialis tadalafil 20 mg cheap tadalafil

Responder

purchase cialis [url=http://aazmencial.com/]cheap tadalafil[/url] discount cialis cialis online pharmacy cialis price

Responder

Hi my family member! I want to say that this post is awesome, great written and come with approximately all vital infos. I¡¦d like to peer extra posts like this .

Responder