Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Number format as condition for not deleting a line

Gentlemen,

Actually, here is a routine I have that works great to delete all row
where the word "Posted" is not found in cell "B" of a row. All
needed to do was tweak this so that is would not look at cell "A" of
row, determine if the value in cell "A" is a number and delete the ro
if it is not.

I know that I would need to change the range to "A1" but do not kno
what I have to do with the 'If ActiveCell = "Posted" Then' text t
get it to look at the numeric cell attribute of the activecell.

Worksheets("sheet1").Activate
Range("B1").Select

Counter = InputBox("Enter the total number of rows to process")

For i = 1 To Counter
If ActiveCell = "Posted" Then
ActiveCell.Offset(1, 0).Select
Selection.EntireRow.Delete
Counter = Counter - 1
Else
Selection.EntireRow.Delete
End If
Next i


Thanks,
Mik

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Number format as condition for not deleting a line

Gentlemen,

The third row of the reply I just sent should read as follows:

would now (instead of not) look at cell "A" of a row, determine if the
value in cell "A" is a number and delete

Sorry,
Mike


---
Message posted from http://www.ExcelForum.com/

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Number format as condition for not deleting a line

Dave,

Thank you very much! Your single-line code worked great!

Happy New Year,
Mike


---
Message posted from http://www.ExcelForum.com/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Number format as condition for not deleting a line

If application.isnumber(activecell.value) then

would check to see if the activecell were numeric.

But your original code actually deletes the row under the cell with posted.

And I'd suggest that you start from the bottom and work upwards if you don't
want to use the routine I posted.




mjwillyone wrote:

Gentlemen,

Actually, here is a routine I have that works great to delete all rows
where the word "Posted" is not found in cell "B" of a row. All I
needed to do was tweak this so that is would not look at cell "A" of a
row, determine if the value in cell "A" is a number and delete the row
if it is not.

I know that I would need to change the range to "A1" but do not know
what I have to do with the 'If ActiveCell = "Posted" Then' text to
get it to look at the numeric cell attribute of the activecell.

Worksheets("sheet1").Activate
Range("B1").Select

Counter = InputBox("Enter the total number of rows to process")

For i = 1 To Counter
If ActiveCell = "Posted" Then
ActiveCell.Offset(1, 0).Select
Selection.EntireRow.Delete
Counter = Counter - 1
Else
Selection.EntireRow.Delete
End If
Next i

Thanks,
Mike

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson

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
deleting rows in a worksheet if condition is met destine Excel Discussion (Misc queries) 3 November 20th 08 01:39 PM
Line Break in Cell Number Format briancrosier Excel Discussion (Misc queries) 8 September 25th 08 09:01 PM
deleting condition after the first duplicate daphoenix Excel Worksheet Functions 9 June 25th 08 06:38 PM
how 2 Count number of cells that have specific condition format? daveydavey Excel Worksheet Functions 2 May 4th 05 02:06 PM
Deleting conditional formats based on condition Todd Huttenstine[_2_] Excel Programming 3 December 14th 03 01:23 AM


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