clear cells contain DATE in column and blank range for the same date

Mussa

Board Regular
Joined
Jul 12, 2021
Messages
241
Office Version
  1. 2019
  2. 2010
Hi guys
I need macro to clear any date in column A and but should contain blank cells in range B: H for the same date
the data could be 10000 rows , some data filling whole range and some data are not filled for whole range .
cell.xlsm
ABCDEFGH
1DATECODEBRANDBATCHDEL NQTYPRICEAMOUNT
226/04/2023CCS-001CTR-001BTR-001CDF-00200102000
326/04/2023CCS-002CTR-002BTR-002CDF-01200102000
426/04/2023
526/04/2023
sh


the outcome should be
cell.xlsm
ABCDEFGH
1DATECODEBRANDBATCHDEL NQTYPRICEAMOUNT
226/04/2023CCS-001CTR-001BTR-001CDF-00200102000
326/04/2023CCS-002CTR-002BTR-002CDF-01200102000
4
5
sh
 
Last edited:

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Try this:
VBA Code:
Sub MyDeleteRows()

    Dim lr As Long
    Dim r As Long
    Dim rng As Range
    
    Application.ScreenUpdating = False
    
'   Find last row in column A with data
    lr = Cells(Rows.Count, "A").End(xlUp).Row
    
'   Loop through all rows backwards
    For r = lr To 2 Step -1
'       Find range to check (columns B to H)
        Set rng = Range("B" & r & ":H" & r)
'       See if no values in range, and delete
        If Application.WorksheetFunction.CountA(rng) = 0 Then Rows(r).Delete
    Next r
        
    Application.ScreenUpdating = True
    
End Sub
 
Upvote 1
Solution
You are welcome!
 
Upvote 0

Forum statistics

Threads
1,215,368
Messages
6,124,520
Members
449,169
Latest member
mm424

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top