Excel VBA Macro: Delete Rows If Any Cell in Those Rows (Across All Columns) Contains a Certain Value

  Рет қаралды 315

greggowaffles

greggowaffles

Күн бұрын

Excel VBA Macro: Delete Rows If Any Cell in Those Rows (Across All Columns) Contains a Certain Value
💥Subscribe: / @greggowaffles
Code:
Sub delete_rows_across_all_cols()
Dim row_count As Long
Dim col_count As Long
Dim i As Long
Dim j As Long
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("NYSE Stocks")
ws.Activate
row_count = ws.Cells(Rows.Count, 1).End(xlUp).Row
col_count = ws.Cells(1, Columns.Count).End(xlToLeft).Column
i = 2
Do While i <= row_count
For j = 1 To col_count
If Cells(i, j) = "" Then
Rows(i).EntireRow.Delete
i = i - 1
row_count = row_count - 1
End If
Next j
i = i + 1
Loop
End Sub
#excelmacro #excelvba

Пікірлер: 7
@sakhilengwenya594
@sakhilengwenya594 Ай бұрын
Thank you 🙏
@alexrosen8762
@alexrosen8762 4 ай бұрын
Superuseful 👌Thanks 🙏
@greggowaffles
@greggowaffles 4 ай бұрын
Appreciate the feedback! Thank you!!
@deepk82
@deepk82 4 ай бұрын
Wow that's great. Very useful. I'm very good at the excel formula, charts, pivot tables and several years ago, I tried learning VBA code but stopped because I wasn't getting the basics so left in between. After watching your videos I am getting a strong feeling to start again. Can you help me again by explaining the basics of defining variables Dim long, string, integer etc. and if , while, looping etc. Thanks in advance. Deep
@greggowaffles
@greggowaffles 4 ай бұрын
Absolutely! Happy to help
@deepk82
@deepk82 4 ай бұрын
How should I begin?
@greggowaffles
@greggowaffles 4 ай бұрын
@@deepk82I recommend just jumping right in and start building your own macros to automate some manual tasks you might have. You’ll learn from your mistakes, and you’ll figure out multiple ways to achieve the same results. Don’t let “analysis paralysis” get to you! 😊
Excel VBA Macro: Insert PivotTable (in Email Body)
9:19
greggowaffles
Рет қаралды 599
Excel VBA Macro: Delete Rows (Based on List of Values)
12:22
greggowaffles
Рет қаралды 607
Пранк пошел не по плану…🥲
00:59
Саша Квашеная
Рет қаралды 6 МЛН
Каха заблудился в горах
00:57
К-Media
Рет қаралды 8 МЛН
EVOLUTION OF ICE CREAM 😱 #shorts
00:11
Savage Vlogs
Рет қаралды 8 МЛН
How to get the Last Row in VBA(The Right Way!)
15:41
Excel Macro Mastery
Рет қаралды 154 М.
How to Get List of File Names in a Folder using Excel
5:40
Excel Weez
Рет қаралды 6 М.
10 awesome Power Query tricks you NEED to know! | Excel Off The Grid
15:44
Excel Off The Grid
Рет қаралды 34 М.
Automate Excel With Python - Python Excel Tutorial (OpenPyXL)
38:02
Tech With Tim
Рет қаралды 1,6 МЛН
I've been using Redis wrong this whole time...
20:53
Dreams of Code
Рет қаралды 345 М.
Delete Rows Based On Criteria Excel VBA Macro
6:39
Excel Macro Mania
Рет қаралды 43 М.
Пранк пошел не по плану…🥲
00:59
Саша Квашеная
Рет қаралды 6 МЛН