Clearing Lines

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,360
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

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

ADAMC

Well-known Member
Joined
Mar 20, 2007
Messages
1,169
Office Version
  1. 2013
Platform
  1. Windows
H:

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

End Sub

deletes rows if completely blank.
 
Upvote 0

ADAMC

Well-known Member
Joined
Mar 20, 2007
Messages
1,169
Office Version
  1. 2013
Platform
  1. Windows
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

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,360
Office Version
  1. 2021
Platform
  1. Windows
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,190,790
Messages
5,982,929
Members
439,807
Latest member
WXM86

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
Top