LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 193
Default Deleting Columns

Need some VB help on deleting columns. I have a VB routine that will delete
entire rows, I just need some help getting it turned around to columns. This
works good and deletes entire blank rows only.

Thanks
Bob

Sub demo()
DeleteBlankDataRows "E", "AI"
End Sub

Sub DeleteBlankDataRows(FromColumn As String, ThruColumn As String)
Dim nFirstRow As Long
Dim nLastRow As Long
Dim nRow As Long
Dim sAddress As String
Dim rng As Range
With ActiveSheet.UsedRange
nLastRow = .Rows.Count + .Row - 1
nFirstRow = .Row
End With
Application.ScreenUpdating = False
For nRow = nLastRow To nFirstRow Step -1
sAddress = FromColumn & nRow & ":" & ThruColumn & nRow
Set rng = Range(sAddress)
If WorksheetFunction.CountBlank(rng) = rng.Count Then
rng.EntireRow.Delete
End If
Next nRow
Application.ScreenUpdating = True
End Sub

 
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
Deleting columns Heather Setting up and Configuration of Excel 4 August 28th 09 01:44 PM
Deleting columns Barry Lennox[_2_] Excel Discussion (Misc queries) 3 January 8th 09 10:00 PM
Adding Columns, Then deleting old columns May Excel Discussion (Misc queries) 4 October 30th 08 04:44 PM
Combining Text from 2 Columns into 1 then Deleting the 2 Columns sleepindogg Excel Worksheet Functions 5 September 19th 08 12:36 AM
deleting columns c_new Excel Discussion (Misc queries) 4 October 26th 05 02:46 PM


All times are GMT +1. The time now is 01:35 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"