Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Deleting entire row


You're welcome. Thanks for the feedback. Otto
"daisy2008" wrote in message
...


Otto, you are so great!!!!!

Thank you so very much.
Daisy




"Otto Moehrbach" wrote:

Daisy
You are probably the victim of line wrapping. This is always a
problem
when code (a macro) is sent to someone in an email or a post. Excel is
very
unforgiving with line wrapping. The DateSerial line is 3 lines to you
and
me but is taken as one line by Excel. For this to work, the underline
(_)
character must be the last character in the line. Rearrange that line so
that it is 3 lines with the underline character at the end of the first 2
lines. Try that. HTH Otto
"daisy2008" wrote in message
...
Thank you Otto

I'm getting a compile error:syntax error and then it highlighted

If Dateserial........

What am I doing wrong?
I have 1000 rows it will need to look through.

"Otto Moehrbach" wrote:

Daisy
Place this macro in the workbook module of your file. HTH Otto
Private Sub Workbook_Open()
Dim rColB As Range
Dim c As Long
With Sheets("3")
Set rColB = .Range("B4", .Range("B" & Rows.Count).End(xlUp))
For c = rColB.Count To 1 Step -1
If DateSerial(Year(Date), Month(rColB(c)), Day(rColB(c)))
<
Date
And _
Year(rColB(c)) + 1 = Year(Date) Then _
rColB(c).EntireRow.Delete
Next c
End With
End Sub
"daisy2008" wrote in message
...
I need an entire row deleted if column 2 on worksheet 3; date is one
year
later but is less then todays date. I need this to run when my
workbook
is
opened.

Ex
B4 January 2, 2008
B5 November 4, 2007
B6 December 26, 2007
B7 December 5, 2007


Row 5 and row 7 are deleted when I open the workbook.










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
Move entire row to another sheet and deleting the old row only. David Bogle Excel Worksheet Functions 0 October 29th 07 05:18 PM
deleting an entire row if the cell in col A is empty Zb Kornecki Excel Programming 1 March 8th 07 01:18 AM
Deleting entire rows based on certain criteria Nan[_4_] Excel Programming 1 July 12th 04 05:04 PM
Code for deleting entire row gregork Excel Programming 2 July 4th 04 12:13 PM
Deleting entire rows Ed C[_3_] Excel Programming 2 June 18th 04 02:14 PM


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