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: 1
Default Number format as condition for not deleting a line

Dear Friends,

I am having a problem with a particular macro I am working on. The
following macro is supposed to delete all rows that do not have a
number in column A. The user enters the number of rows to process,
then lets the macro do its job. Unfortately, I end up with all of the
rows being deleted.

I have checked my data on the test page and I have two rows that
contain numbers in column A. I have verified that these are numbers
by right-clicking over these cells and choosing cell-format - both are
listed as "number".

Here is the code that I have created . . .

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

Worksheets("sheet1").Activate
Range("A1").Select
For i = 1 To Counter
If ActiveCell.NumberFormat = "Number" Then
ActiveCell.Offset(1, 0).Select
Selection.EntireRow.Delete
Counter = Counter - 1
Else
Selection.EntireRow.Delete
End If
Next i

Thank you for your help!

Mike


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

 
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 09:13 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"