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 deleteing specific rows using a userform


'ive got a userform into which the user enters a particular date.
'The code then looks at each cell to see if the date in the cell is
'greater than the date entered by the user. If it is, then the row is
deleted
'if not then look at the next cell down.
'stop when nothing is in the cell.
'the problem i have is that, say i enter the date 12/05/2006, then run
the program,
'the dates after 12/05/2006 get deleted (which is correct), but it also
deletes
'12/05/2006 rows aswell (which is not right).
'i cant work out whats wrong, or any other way of doing it. Any help
please? much appreciated.

code:

Private Sub CommandButton2_Click()

Dim date2 As Date

date2 = TextBox2.Text

Range("F9").Select

Do Until ActiveCell.Value = ""

If ActiveCell date2 Then ActiveCell.EntireRow.Delete
If ActiveCell < date2 Then ActiveCell.Offset(1, 0).Activate

Loop

End Sub


--
s_ali_hassan
------------------------------------------------------------------------
s_ali_hassan's Profile: http://www.excelforum.com/member.php...o&userid=35325
View this thread: http://www.excelforum.com/showthread...hreadid=555542

 
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
Deleteing empty rows Ken G. Excel Discussion (Misc queries) 3 June 28th 05 01:18 AM
Deleteing some Rows Deepwater Excel Discussion (Misc queries) 1 April 1st 05 06:23 PM
Deleteing Rows Michael Vaughan Excel Programming 2 September 20th 04 09:53 PM
Deleteing Duplicate Rows??? James Excel Programming 13 June 4th 04 03:24 PM
Deleteing Rows Amber[_2_] Excel Programming 3 February 4th 04 06:34 PM


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