Clearing Lines

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,561
Office Version
  1. 2021
Platform
  1. Windows
I have a worksheet containing amongst other lines that are imported which I want cleared using VBA

----------

==========

I have attached a sample file. It would be appreciated if you would assist

Howard
Lines.xls
ABCDEF
1
2
3TOTALNETSALES
4TOTALCOSTOFSALES
5TOTALOVERALLOWANCE
6----------------------------------------
7TOTALFRONTENDG/PROFIT
8TOTALBACKENDG/PROFIT
9TOTALG/PROFITADJUSTMENT
10----------------------------------------
11TOTALADJ'DGROSSPROFIT
12EXPENSES-VARIABLES
13EXPENSES-PERSONNEL
14EXPENSES-SEMI/FIXED
15EXPENSES-TOTAL
16----------------------------------------
17TOTALNET(PROFIT)/LOSS
18========================================
19
20
21
22
23
Sheet1
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
H:

Code:
Sub DeleteRowOnCell()
On Error Resume Next
Selection.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
ActiveSheet.UsedRange

End Sub

deletes rows if completely blank.
 
Upvote 0
Sorry misunderstood the question:

Code:
Sub Deletenone()
Dim Last, i As Long

Last = Cells(Rows.Count, "A").End(xlUp).Row
Application.ScreenUpdating = False
For i = Last To 1 Step -1
If (Cells(i, "A").Value) = "" Then
Cells(i, "A").EntireRow.Delete
End If

Next i
Application.ScreenUpdating = False

End Sub

this will delete a row if column A has an empty cell ("")
 
Upvote 0
Deleting Rows

Hi ADAMC

Thanks for the help. Macro works perfectly.

I would also like VBA code the will clear the lines in columns B:E per my sample uploaded in my earlier post


Howard
 
Upvote 0

Forum statistics

Threads
1,214,665
Messages
6,120,801
Members
448,992
Latest member
rohitsomani

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