VBA- Delete rows and maintain data of one specific column

Dancarro

Board Regular
Joined
Feb 23, 2013
Messages
65
Hi,

I need your help in relation to Excel 2010.

In one of my worksheet I have data entered in A1:F200 and some rows are blank.

I want to show only the information of the respective rows which contains information in column F, and to delete all the remaining rows and to go the next row where information is located in column F.

For example: A B C D E F
1 _x______x____x______________ x
2 ________x____x__________x ___x
3 ________x____x________________
4 ______________________________
5__x__________________________x
6 _ x_____x_____________________
7 _________________ x____x____x

x= data inserted in the cell


Referring to the above example, what I need to show is the following:
Row 1: This row to stay, as it has information in cell F1.
Row 2: This row to stay as it has information in cell F2.
Row 3: Can be deleted - No information in F3.
Row 4: No information and to be deleted.
Row 5: This row to stay, as it has information in cell F5.

I would appreciate your help regarding my problem and if there is a VBA code to assist me.

Kind Regards,
Daniel
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Try
Code:
Sub MM1()
Dim r As Long
For r = 200 To 1 Step -1
    If Range("F" & r).Value = "" Then Rows(r).Delete
Next r
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,595
Members
449,089
Latest member
Motoracer88

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