Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() The structure is good, but there are a few problems with your code: 1. The rng variable will pick up only the text values, so .count ma not reflect the entire range you want to work with. 2. The rng variable is not an array so you can't use rng(i) 3. Left works like this Left(CellValue, 1) to get the first characte on the left. I'd recode it like this: Code ------------------- Sub Delete_rows_based_on_Closing() Dim i As Long Application.ScreenUpdating = False Application.Calculation = xlCalculationManual For i = Range("C65536").End(xlUp).Row To 1 Step -1 If UCase(Left(Range("C" & i).Value, 1)) = "H" And UCase(Range("K" & i).Value) = "CLOSING" Then Range("C" & i).EntireRow.Delete End If Next Application.Calculation = xlCalculationAutomatic Application.ScreenUpdating = True End Su ------------------- Basically, loop from the last used cell in column C up to C1. Chec the C column for a value starting with H and the K column for CLOSING. If found, delete it. -- kkkni ----------------------------------------------------------------------- kkknie's Profile: http://www.excelforum.com/member.php...nfo&userid=754 View this thread: http://www.excelforum.com/showthread.php?threadid=26547 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro for deleting rows and serialising the remaing rows | Links and Linking in Excel | |||
Macro for deleting rows and serialising the remaing rows | Setting up and Configuration of Excel | |||
Macro for deleting rows and serialising the remaing rows | Excel Worksheet Functions | |||
Help!! I have problem deleting 2500 rows of filtered rows!!!! | Excel Discussion (Misc queries) | |||
deleting hidden rows so i can print only the rows showing?????? | Excel Worksheet Functions |