LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #16   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Deleting a row

That will put a space in the cell, but not what I am talking about.

--
Regards,
Tom Ogilvy

"Don Guillett" wrote in message
...
or accidentally touching the space bar will do it

--
Don Guillett
SalesAid Software

"Tom Ogilvy" wrote in message
...
I don't follow exactly what you did, but if you put
=""
in a cell, then do edit=copy and Edit=paste Special and select values,
the
cell will have a len of zero but will not be empty.

Therefore SpecialCells(xlBlanks) will not pick it up since it isn't

blank.

--
Regards,
Tom Ogilvy




"Mike Fogleman" wrote in message
...
Tom, oddly enough, in my test sheet if I inserted 2 spaces into the

Blank
cells, then did Trim function and paste special values, Don's code

still
did
not work, telling me the cells are still not truly blank! Only when I
Cleared Contents did Don's code work. Hmmm.

Mike F

"Don Guillett" wrote in message
...
Agreed.


--
Don Guillett
SalesAid Software

"Tom Ogilvy" wrote in message
...


Sub deleteRowsWithBlanksInC()
For i = Cells(Rows.Count, "c").End(xlUp).Row To 2 Step -1
If len(trim(Cells(i, "c"))) = 0 Then Rows(i).Delete
Next i
End Sub

would be more robust.

--
Regards,
Tom Ogilvy


"Don Guillett" wrote in message
...
I think OP said "blank" so it's unlikely there would be more than

one
space.

--
Don Guillett
SalesAid Software

"Mike Fogleman" wrote in message
...
Don, this will work if there is only one space in the cell. What

if
there
are two or more. My code, although not as compact as yours, will
compare
the number of spaces to the length of the text, and if they are

equal,
no
matter how many there are, it will delete the row.
Sound reasonable? If the length is 0 then it will immediately
delete
the
row without testing for spaces.
Mike F
"Don Guillett" wrote in message
...
try this to get spaces and blanks
Sub deleteallblanks()
For i = Cells(Rows.Count, "c").End(xlUp).Row To 2 Step -1
If Cells(i, "c") = " " Or Cells(i, "c") = "" Then Rows(i).Delete
Next i
End Sub

--
Don Guillett
SalesAid Software

"Neal" wrote in message
...
I tried it and nothing happened!

"Don Guillett" wrote:

try
Sub RowBeGone()
Columns("c").SpecialCells(xlCellTypeBlanks).Entire Row.Delete
End Sub

--
Don Guillett
SalesAid Software

"Neal" wrote in message
...
How would I write the code to delete a row depending on if a
certain
cell
is
blank?
If e1 is blank delete row 1 and so on.

range("C").Select
do
row.Delete Shift:=xlUp
loop until isempty(activecell<" ")

Or something like this? I would greatly appreciate the help.
Thanks
Neal.





















 
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 the text without deleting the formula gems04 Excel Worksheet Functions 3 January 30th 09 11:21 PM
Deleting cell data without deleting formula Tom Hall Excel Discussion (Misc queries) 4 October 29th 06 04:07 PM
deleting values in a worksheet without deleting the formulas patti Excel Worksheet Functions 1 October 28th 05 09:49 PM
how prevent formula in cell from deleting when deleting value???? sh-boom New Users to Excel 1 September 30th 05 06:12 PM
Deleting Hyphens or Dashes from multiple cells without deleting the remaining content rmaloy Excel Programming 5 February 9th 04 01:59 AM


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