Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Delete Blank Excel Rows

Hello All

I have a problem, i have a worksheet that contains 500 rows of data.
Now between these 500 rows there are multiple blank cells, that are
not evenly distributed in the columns. Now for a perticular column i
want to remove the blank cell . Kindly provide me with some example. I
am provided some example below.


A B C
1 1 1
2 1
------------------------------------
------------------------------------
2 1 2
2 2'
3 3
---------------------------------------
---------------------------------------
----------------------------------------

i only want to remove blank cells from column B

Thanks in advance
Shantanu
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Delete Blank Excel Rows

Hi

Assuming you want to delete entire row when a cell in column B is blank,
this should do it:

Sub RemoveBlankCells()
LastRow = Range("B" & Rows.Count).End(xlUp).Row
For r = LastRow To 1 Step -1
If Cells(r, 2).Value = "" Then
Rows(r).Delete
End If
Next
End Sub

Regards,
Per

"shantanu" skrev i meddelelsen
...
Hello All

I have a problem, i have a worksheet that contains 500 rows of data.
Now between these 500 rows there are multiple blank cells, that are
not evenly distributed in the columns. Now for a perticular column i
want to remove the blank cell . Kindly provide me with some example. I
am provided some example below.


A B C
1 1 1
2 1
------------------------------------
------------------------------------
2 1 2
2 2'
3 3
---------------------------------------
---------------------------------------
----------------------------------------

i only want to remove blank cells from column B

Thanks in advance
Shantanu


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Delete Blank Excel Rows

Or if you want to delete empty cells in just column B

Sub RemoveBlankCells()
LastRow = Range("B" & Rows.Count).End(xlUp).Row
For r = LastRow To 1 Step -1
If Cells(r, 2).Value = "" Then
Cells(r, 2).Delete Shift:=xlUp
End If
Next
End Sub


Gord Dibben MS Excel MVP

On Thu, 5 Feb 2009 08:57:46 +0100, "Per Jessen" wrote:

Hi

Assuming you want to delete entire row when a cell in column B is blank,
this should do it:

Sub RemoveBlankCells()
LastRow = Range("B" & Rows.Count).End(xlUp).Row
For r = LastRow To 1 Step -1
If Cells(r, 2).Value = "" Then
Rows(r).Delete
End If
Next
End Sub

Regards,
Per

"shantanu" skrev i meddelelsen
...
Hello All

I have a problem, i have a worksheet that contains 500 rows of data.
Now between these 500 rows there are multiple blank cells, that are
not evenly distributed in the columns. Now for a perticular column i
want to remove the blank cell . Kindly provide me with some example. I
am provided some example below.


A B C
1 1 1
2 1
------------------------------------
------------------------------------
2 1 2
2 2'
3 3
---------------------------------------
---------------------------------------
----------------------------------------

i only want to remove blank cells from column B

Thanks in advance
Shantanu


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
Can I delete blank rows from excel without selecting them? rgtest Excel Worksheet Functions 9 February 14th 09 03:12 PM
How to delete blank rows at one time in a long excel spreadsheet? lkurokawa Excel Worksheet Functions 2 March 19th 08 09:01 PM
Delete Rows if any cell in Column H is blank but do not Delete Fir manfareed Excel Programming 4 September 28th 07 05:20 PM
Excel Novice: Delete blank rows Kezia Excel Discussion (Misc queries) 2 August 25th 06 04:56 PM
Delete blank rows in Excel with macro Pele[_2_] Excel Programming 6 November 3rd 04 06:53 PM


All times are GMT +1. The time now is 11:33 PM.

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"