Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 22
Send a message via Skype™ to Bakar
Cool Delete rows in Table

Hi Everyone
I have a table with column A to J fill with data
and in column F i have Inactive and Active
I want to delete only rows that is Inactive and the active fill all empty rows
with vba

Thanks for ur usual help

Bakar

Thanks very much you r the best

Last edited by Bakar : November 19th 12 at 01:58 PM Reason: solved
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Delete rows in Table

Hi,

Am Sun, 18 Nov 2012 13:28:46 +0000 schrieb Bakar:

I have a table with column A to J fill with data
and in column F i have Inactive and Active
I want to delete only rows that is Inactive and the active fill all
empty rows
with vba


try:
Sub Test1()
Dim LRow As Long
Dim SRow As Long

With ActiveSheet
LRow = .Cells(.Rows.Count, "F").End(xlUp).Row
..Range("A1:J" & LRow).Sort Key1:=Range("F1"), _
Order1:=xlAscending, Header:=xlYes
SRow = WorksheetFunction.Match("Inactive", Range("F1:F" & LRow), 0)
.Rows(SRow & ":" & LRow).Delete
End With
End Sub

or:
Sub Test2()
Dim LRow As Long
Dim i As Long

LRow = Cells(Rows.Count, "F").End(xlUp).Row
For i = LRow To 2 Step -1
If Cells(i, "F") = "Inactive" Then
Rows(i).Delete
End If
Next
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Allowing Delete Table Rows at a Cells Protected Worksheet Rob2204 Excel Discussion (Misc queries) 0 January 19th 10 05:31 PM
delete all blank rows in a table marcia2026 Excel Programming 2 July 12th 08 01:01 AM
Delete all Blank Rows from data table Shazi Excel Programming 3 June 25th 08 10:19 PM
Coded to delete extra rows after pivot table klysell Excel Programming 2 February 11th 08 03:51 PM
Code to Delete Empty Rows in a Word Table Araknia777 via OfficeKB.com Excel Programming 0 August 9th 05 06:23 PM


All times are GMT +1. The time now is 10:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"