Stumped on How to remove unwanted lines

tassie

Board Regular
Joined
Apr 5, 2004
Messages
179
gmroi.xls
ABCDEFGH
1
2
3
411/11/2005GLGunns Limited
59:00:51Product Status byWarehouse - Compact (Menu IB1)
6---------------------------------------------------------------------------------------------------
7StockReservedCustomerCurrent
8ProductDescription Vendor StatusOnhandSalesBack OrderAvailable
9QtyQtyQtyQty
10---------------------------------------------------------------------------------------------------
11
12
13100147BERG JET DRY N/SLIP F/RED 1LTDULUXA15005
14100152BERG JET DRY N/SLIP F/GREEN 4LDULUXA14004
15100153BERG JET DRY N/SLIP F/GREEN 1LDULUXA14004
16100170BERG JET DRY N/SLIP F/RED 4LTDULUXA14004
17101616BERG TRUE GRIP #N95 300GDULUXA13003
18102154T/P WOODSTAIN BALTIC PINE 4LTTASPAB12002
19102186SOLAGARD GLOSS DTB 10LTRWATTYA12002
20102612ID GLS ENAMEL WHITE 4LTWATTYA12002
21102615ID UNDERCOAT MULTI PURP 4 LTWATTYA16015
22102689T/P WOODSTAIN MAHOGANY 500MLTASPAB14004
23102690T/P WOODSTAIN BALTIC PINE 500MTASPAB14004
24102691T/P WOODSTAIN WALNUT 500MLTASPAB16006
25102692T/P WOODSTAIN CEDAR 500MLTASPAB13003
26102779T/P THINNERS ROAD MARKING 4LTASPAB12002
27103280FILLER HEAVY DUTY RTU ACCENTMITREB11001
28103281FILLER FINE SURFACE RTU ACCENTMITREB16006
29103282FILLER FLEXI WOOD RTU ACCENTMITREB17-108
IB1_status


Hi Guys,

I have several reports which are imported into Excel.
The challenge I am having is getting rid off the lines between each page
so that I am only using data.

I have tried using filters with not much success.

Is there a way with a function that can detect if cells in column A are
numeric if so retain that line otherwise delete it?

Appreciate any feedback

Thanks & Regards

Tassie :cry:
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
I frequently do what you are doing.

I have written a small excerpt of the code I use, you will need to adjust to suit your needs.

I will help further where I can.

<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> test()
<SPAN style="color:#00007F">Set</SPAN> TestRange = Intersect(Range("A:A"), ActiveSheet.UsedRange)
lastrowsrc = TestRange.Cells(TestRange.Cells.Count).Row <SPAN style="color:#007F00">'get last row number in the range</SPAN>
firstrowsrc = TestRange.Cells(1).Row <SPAN style="color:#007F00">'get the first row number in the range</SPAN>
<SPAN style="color:#007F00">'Collect the required data from the specific cells by looping through the rows</SPAN>
<SPAN style="color:#00007F">For</SPAN> I = lastrowsrc <SPAN style="color:#00007F">To</SPAN> firstrowsrc <SPAN style="color:#00007F">Step</SPAN> -1
    Cells(lastrowsrc, 1).Select
    <SPAN style="color:#00007F">If</SPAN> ActiveCell.Value = "What ever" <SPAN style="color:#00007F">Or</SPAN> ActiveCell.Value = Emtpy <SPAN style="color:#00007F">Or</SPAN> ActiveCell.Value = "anything" <SPAN style="color:#00007F">Then</SPAN>
        EntireRow.Delete
    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>
<SPAN style="color:#00007F">Next</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>
 
Upvote 0
Hi jag108 ,

Thanks for your solution and the offer of
further assistance if needed.


Tassie
 
Upvote 0
Cosmetic surgery.

Sorry, couldn't resist.

If you only do this occasionally (which I don't think you do), you could add another column and insert incremental numbers from 1 to whatever. For example in Column A.

Then you sort on the column of numeric data. All the non-numeric stuff like titles and dashes go to the top or bottom depending if you chose ascending or descending sort order. Then you can delete these extraneous lines. Re-sort on Column A to get the data in the original order.
 
Upvote 0
Hi jag108,


Sheets("IB1_status").Select
Set TestRange = Intersect(Range("A:A"), ActiveSheet.UsedRange)
lastrowsrc = TestRange.Cells(TestRange.Cells.Count).Row 'get last row number in the range
firstrowsrc = TestRange.Cells(1).Row 'get the first row number in the range
'Collect the required data from the specific cells by looping through the rows

Range("A1").Select
ActiveCell = firstrowsrc
Range("A2").Select
ActiveCell = lastrowsrc

For I = lastrowsrc To firstrowsrc Step -1
Cells(lastrowsrc, 1).Select
If ActiveCell.Value = "" Then ' testing for spaces
EntireRow.Delete
End If
Next
End Sub

Hve included some lines for testing
Bold line entire row delete displays debug.
Runtime erroe 424 object required.

Tassie.
 
Upvote 0
Replace "EntireRow.Delete" with "ActiveCell.EntireRow.Delete".

OR

You could add "ActiveCell" before "EntireRow.Delete" to get "ActiveCell.EntireRow.Delete".

OR

You could erase "EntireRow" and replace it with "ActiveCell.EntireRow" to get "ActiveCell.EntireRow.Delete".

Any of the above, or any other combination that will get you to "ActiveCell.EntireRow.Delete" should solve your problem :)
 
Upvote 0

Forum statistics

Threads
1,203,171
Messages
6,053,876
Members
444,692
Latest member
Queendom

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