Saltar al contenido
PROGRAMAR EN VBA MACROS DE EXCEL

Rellenar celdas con cero

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

Esta macro es algo sencilla, pero no por ello deja de ser útil, lo que realiza  esta macro de Excel o código de VBA es rellenar con cero todas las celdas vacías, haciendo un bucle y determinando que celdas están vacías, en ese caso agrega cero, tiene cierta relación con las macros, recorrer filas contando celdas con datos, como así también con la macro recorrer filas encontrar un dato y sumarlo, la diferencia es que en una cuenta las celdas con datos y en la otra los suma.

Antes de seguir con el desarrollo y en el caso que no tengas conocimiento suficiente sobre el manejo de hojas de Excel, te recomiendo antes de introducirte en el mundo de las macros, que leas un excelente libro sobre Excel el que te ayudará manejar las planillas de cálculo, debes hacer click acá, si quieres un libro sobre Excel, en inglés, entonces debes hacer click acá. Si lo que necesitas es aprender o profundizar sobre la programación de macros con VBA este es unos de los mejores curso que he visto en internet.

MASTERCARD PAYONEER

En el ejemplo se pueden observar dos botones uno tiene asociada una macro que rellena las celdas vacías con ceros y el otro borra todas las celdas que tienen valor cero.

Desde el link del final se puede descargar el archivo de ejemplo de esta manera podrás ver su funcionamiento en forma más detallada. También desde la final del post podrás aportar para seguir manteniendo este blog y de esta manera agregar muchos más ejemplos de macros que son de utilidad.

En resumen el código de VBA o Macro de Excel presentado en este post rellena con ceros o cualquier otro carácter para ello solo se debe hacer una pequeña modificación a la macro, todas las celdas vacías; también se agrega un código para limpiar las celdas dejándo las celdas vacías, si son igual a cero; de esta  manera podrás probar la macro ya que una macro rellena con ceros y la otra macro borra las celdas con cero. El código está abierto y se puede adaptar a cada necesitad en particular.

Código que se debe insertar en un módulo


Sub rellena()
Dim uf, fila As Integer
uf = Sheets(«hoja1»).Range(«A» & Rows.Count).End(xlUp).Row
fila = 2
While fila <= uf
If Sheets(«hoja1»).Cells(fila, 3) = Empty Then
   Sheets(«hoja1»).Cells(fila, 3) = 0
End If
fila = fila + 1
Wend

fila = 2

While fila <= uf
If Sheets(«hoja1»).Cells(fila, 4) = Empty Then
   Sheets(«hoja1»).Cells(fila, 4) = 0
End If
fila = fila + 1
Wend
End Sub

Sub borracero()
Dim uf, fila As Integer
uf = Sheets(«hoja1»).Range(«A» & Rows.Count).End(xlUp).Row
fila = 2
While fila <= uf
If Sheets(«hoja1»).Cells(fila, 3) = 0 Then
   Sheets(«hoja1»).Cells(fila, 3) = Empty
End If
fila = fila + 1
Wend

fila = 2


     

While fila <= uf
If Sheets(«hoja1»).Cells(fila, 4) = 0 Then
   Sheets(«hoja1»).Cells(fila, 4) = Empty
End If
fila = fila + 1
Wend
End Sub

Otros post de utilidad:

  1. Recuperar password de hoja bloqueada
  2. Abre explorador de archivo de Windows e inserta foto
  3. Abre explorador de archivo de Windows
  4. Combobox suma datos repetidos
  5. Busca un dato en todas las hojas de excel
  6. Combobox incrustado en Excel
  7. Formulario para insertar datos en hoja de excel
  8. Formulario de alera y envío de mail
  9. Tutoriales sobre VBA
  10. Llenar combobox y buscar datos
  11. Mensaje de Alerta y envío de mail con Excel
  12. Combobox que lista hojas de excel y las selecciona
  13. Busca un dato en todas las hojas de excel

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 una respuesta

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

Comentarios (3)

The residential or commercial properties of cannabis were recognized in ancient times. This plant has actually been utilized as a remedy for many ailments given that the beginning of time. Marijuana, unlike marijuana, does not contain the THC medicine, which is why you can not be intoxicated with it. However, the secret to their solid therapeutic buildings is another natural component – cannabidiol for short called CBD. What is CBD? Cannabidiol or CBD is among over 80 compounds from the group of particles called cannabinoids, as well as one of over 480 substances naturally discovered in marijuana. Of these substances, CBD as well as THC are discovered in the greatest concentrations of marijuana – which is why they are the most well-known and best studied. CBD is the legal as well as most important energetic material in clinical marijuana as well as marijuana, with a very vast range of activity. Of the a number of hundred materials located in hemp, CBD has the best health and wellness buildings. CBD hemp seed oil is not psychoactive and also can be utilized as a detailed restorative representative without concern of changing awareness. Cannabidiol (CBD), unlike THC, does not create side effects, is not intoxicating or habit forming. CBD is a totally secure hemp active ingredient that imitates the impacts of naturally taking place materials in the human body. CBD is a vegetable oil that can only be located in hemp in nature. Therapeutic homes of cannabidiol (CBD): Neuroprotective and also neuroactive – fights neurodegenerative as well as mental illness, regrows nerve cells in the body, boosts the nerves, protects against and also protects against neurodegeneration, has a relaxing and anti-spastic effect. Anticancer – assaults and ruins cancer cells, prevents the expansion of cancer cells, leads to apoptosis or self-destruction of cancer cells. Antioxidant – reduces oxidative anxiety, decreases as well as stops aging of cells and also cells, sustains the body’s natural defenses, safeguards against cost-free radicals. Anti-inflammatory – prevents the inflammatory process, fights swelling, prevents the formation of swelling. Analgesic – eliminates discomfort, relieves and also eliminates pain throughout the body used both inside and on the surface. Antipsychotic – sober up and also cleans up the mind, fights psychosis and stress and anxiety, cools down and soothes, relaxes, relaxes as well as provides excellent rest. Antiemetic – decreases nausea or vomiting as well as throwing up, boosts thirst and appetite, impacts typical body metabolism. Antibacterial – has strong antiseptic residential properties, damages germs as well as stops their reproduction, decreases their growth. Antifungal – prevents the advancement of fungal diseases, eliminates mold and mildew and also fungis. Antiallergic – soothes and also eliminates allergy symptoms, Immunological – boosts the body’s all-natural resistance, promotes homeostasis. Dermatological – speeds up injury healing, battles skin diseases, rejuvenates the skin. The trick to their solid restorative residential or commercial properties is one more natural active ingredient – cannabidiol for short called CBD. CBD is the lawful as well as most essential active substance in clinical marijuana and marijuana, with a very wide range of task. Of the a number of hundred materials found in hemp, CBD has the greatest health residential properties. Cannabidiol (CBD), unlike THC, does not cause side results, is habit forming or not intoxicating. CBD is a totally risk-free hemp active ingredient that resembles the results of normally happening substances in the human body.

Responder

We stumbled over here coming from a different website and thought I might check things out. I like what I see so now i am following you. Look forward to checking out your web page for a second time.

Responder

I used to be very happy to search out this web-site.I wished to thanks in your time for this glorious learn!! I positively enjoying each little little bit of it and I’ve you bookmarked to take a look at new stuff you weblog post.

Responder