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: 14
Default Range question w/VB

With the following macro (copied from this usenet, modified & working
thank you) is there a way the row number (in this example 771) updates
automatically when I manually add rows between 3 & 771.

******************
Dim rng As Range, i As Long
Dim lastrow As Long
With Worksheets("Sheet1")
Set rng = .Range(.Cells(3, 2), .Cells(771, 2).End(xlUp))
End With
With Worksheets("Sheet3")
lastrow = .Cells(Rows.Count, 1).End(xlUp).Row
For i = lastrow To 1 Step -1
If Application.CountIf(rng, .Cells(i, 1)) < 0 Then
.Rows(i).Delete
End If
Next i
End With
*********************

TIA

Ron
 
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
Range Question / error 1004: method Range of object Worksheet has failed Paul Excel Programming 3 April 7th 05 02:56 PM
range question CG Rosén Excel Programming 2 November 26th 04 02:21 PM
Range question strataguru[_19_] Excel Programming 2 September 25th 04 12:57 AM
Used Range Question a Excel Programming 2 May 26th 04 03:45 AM
Range.Formula and Range question using Excel Automation [email protected] Excel Programming 0 September 19th 03 04:53 AM


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