Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default visual basic macro code for deleting referenced rows

Try this - checks a1 to a12 deleting rows if the cell is blank.



to find the last row used in a column replace
For r = 12 To 1 Step -1
with
For r = Range("a65536").End(xlUp).Row To 1 Step -1




Sub DelRow()
Dim r As Long
For r = 12 To 1 Step -1
If Cells(r, "a") = "" Then
Rows(r).Delete
End If
Next r
End Su

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default visual basic macro code for deleting referenced rows

Thanks for the advice, but my question wasn't clear. I have a single column with cells that either contain text or a value. I need to select those cells that contain a value and delete the rows those cells are in. I want to keep the rows that cells with text are in. Thanks again.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default visual basic macro code for deleting referenced rows

Columns(1).SpecialCells(xlConstants,xlNumbers).Ent ireRow.Delete

--
Regards,
Tom Ogilvy

nathan wrote in message
...
Thanks for the advice, but my question wasn't clear. I have a single

column with cells that either contain text or a value. I need to select
those cells that contain a value and delete the rows those cells are in. I
want to keep the rows that cells with text are in. Thanks again.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default visual basic macro code for deleting referenced rows

So hard and yet so easy! Thanks, it works great.
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
Deleting rows in two columns with a code in visual basic Ruben Excel Discussion (Misc queries) 5 August 27th 08 09:10 AM
Data filter and deleting rows in visual basic Ruben Excel Discussion (Misc queries) 0 August 24th 08 08:38 PM
Selecting Cells With Visual Basic or Macro Code RajenRajput1 Excel Discussion (Misc queries) 5 May 11th 07 05:56 PM
Deleting pictures in Excel using visual basic [email protected] New Users to Excel 3 October 6th 06 07:48 PM
visual basic macro code for deleting referenced rows Frank Kabel Excel Programming 0 January 28th 04 10:05 PM


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