Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-25-2013, 11:51 AM
Rok Rok is offline Delete row when 2 column has no value Windows 7 64bit Delete row when 2 column has no value Office 2010 32bit
Novice
Delete row when 2 column has no value
 
Join Date: Nov 2013
Posts: 1
Rok is on a distinguished road
Default Delete row when 2 column has no value

Hi,



I have found this macro which is working, but not entirely as I want.
I need that macro go through every table in document - now it only works in one table.

Public Sub DeleteEmptyColums()
Dim Table As Table, Row As Range, Cell As Cell, Counter As Long, _
NumRows As Long, TextInRow As Boolean
' Specify which table you want to work on.
Set Table = Selection.Tables(1)
' Set a range variable to the first row's range
Set Row = Table.Rows(1).Range
NumRows = Table.Rows.Count
' Next Table
Application.ScreenUpdating = False
For Counter = 1 To NumRows
StatusBar = "Row " & Counter
TextInRow = False

With Selection.Tables(1)
For i = .Rows.Count To 1 Step -1
If Len(.Cell(i, 2).Range.Text) = 2 Then
.Rows(i).Delete
End If
Next i
End With
Next Counter
Application.ScreenUpdating = True
End Sub

Any ideas?
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete row when 2 column has no value How do you delete email domains in an Excel column? sjeff Excel 2 10-22-2013 11:21 PM
Delete row when 2 column has no value Automatically enter date into a column and make that column read only Mr Davo Excel 1 10-29-2012 01:07 AM
Can I change the horizontal scrollbar to scroll smoothly rather than column by column carpat Excel 0 01-10-2012 09:34 AM
How can I delete the content of a cell in column if the cell value is more than 1000? Learner7 Excel 2 06-27-2011 05:44 AM
delete email message via blackberry and have it delete on my pop3 and my outlook Iamthestorm Outlook 2 10-28-2010 12:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:45 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft