Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
Can anyone help me with changing the vba code below to delete each ro with a text field in column c1:c10000? I am new to vba and just manag to hack something up. However this code only deletes blank cells an not cells with text. Also is there a better way to specify the column range instead of doin it by specifying the range like this...Set Rng ActiveSheet.Range("C1:C10000"). i.e. Is there a way to make it dynamic so regardless of how many rows there are, it will run through each an every row with data in it. The problem that I faced is my data has th occasionaly blank row between each row with data. Anyway, enough said. Here is my code. Thanks in advance. Sub DeleteText() ' ' Delete blank lines in column C ' Macro recorded 23/08/2004 by zsalleh ' ' Windows("Workbook v2.xls").Activate Sheets("Consolidation").Select Application.ScreenUpdating = False Dim Rng As Range Set Rng = ActiveSheet.Range("C1:C10000") For ix = Rng.Count To 1 Step -1 If Trim(Replace(Rng.Item(ix).Text, Chr(160), Chr(32))) = " Then Rng.Item(ix).EntireRow.Delete End If Next Application.ScreenUpdating = True End Su -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to Delete the last N rows | Excel Discussion (Misc queries) | |||
Macro to delete rows if... | Excel Discussion (Misc queries) | |||
Need macro to delete all text cells in an Excel range | Excel Worksheet Functions | |||
delete empty rows between rows with text | Excel Discussion (Misc queries) | |||
macro to delete entire rows when column A is blank ...a quick macro | Excel Programming |