Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
vee vee is offline
external usenet poster
 
Posts: 12
Default Conditional row selection

I posted this before but can't find it, so here it is again.

I am trying to delete and entire row if column "A" contains "Void". Below
is the code that I have written. It wigs out when I try to select the entire
row.

Do While ActiveCell.Value < ""
If ActiveCell.Value = "Void" Then
ActiveRow.Select
Selection.Delete Shift:=xlUp
Else
ActiveCell.Offset(1, 0).Select
End If
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Conditional row selection

hi
try this..
change..
activerow.select
selection.delete shift:=xlup

to....
Activecell.entirerow.delete shift:=xlup

truthfully, i don't think there is such a thing as activerow.

Regards
FSt1


"Vee" wrote:

I posted this before but can't find it, so here it is again.

I am trying to delete and entire row if column "A" contains "Void". Below
is the code that I have written. It wigs out when I try to select the entire
row.

Do While ActiveCell.Value < ""
If ActiveCell.Value = "Void" Then
ActiveRow.Select
Selection.Delete Shift:=xlUp
Else
ActiveCell.Offset(1, 0).Select
End If

  #3   Report Post  
Posted to microsoft.public.excel.programming
vee vee is offline
external usenet poster
 
Posts: 12
Default Conditional row selection

Thanks!

"FSt1" wrote:

hi
try this..
change..
activerow.select
selection.delete shift:=xlup

to....
Activecell.entirerow.delete shift:=xlup

truthfully, i don't think there is such a thing as activerow.

Regards
FSt1


"Vee" wrote:

I posted this before but can't find it, so here it is again.

I am trying to delete and entire row if column "A" contains "Void". Below
is the code that I have written. It wigs out when I try to select the entire
row.

Do While ActiveCell.Value < ""
If ActiveCell.Value = "Void" Then
ActiveRow.Select
Selection.Delete Shift:=xlUp
Else
ActiveCell.Offset(1, 0).Select
End If

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Conditional row selection

Hi,

Right click your sheet tab, view code and paste this in. Select you data in
column A and run the macro.

Sub merse()
For Each c In Selection
If c.Value = "Void" Then
c.EntireRow.Delete
End If
Next
End Sub

Mike

"Vee" wrote:

I posted this before but can't find it, so here it is again.

I am trying to delete and entire row if column "A" contains "Void". Below
is the code that I have written. It wigs out when I try to select the entire
row.

Do While ActiveCell.Value < ""
If ActiveCell.Value = "Void" Then
ActiveRow.Select
Selection.Delete Shift:=xlUp
Else
ActiveCell.Offset(1, 0).Select
End If

  #5   Report Post  
Posted to microsoft.public.excel.programming
vee vee is offline
external usenet poster
 
Posts: 12
Default Conditional row selection

Thank You - It worked

"Mike H" wrote:

Hi,

Right click your sheet tab, view code and paste this in. Select you data in
column A and run the macro.

Sub merse()
For Each c In Selection
If c.Value = "Void" Then
c.EntireRow.Delete
End If
Next
End Sub

Mike

"Vee" wrote:

I posted this before but can't find it, so here it is again.

I am trying to delete and entire row if column "A" contains "Void". Below
is the code that I have written. It wigs out when I try to select the entire
row.

Do While ActiveCell.Value < ""
If ActiveCell.Value = "Void" Then
ActiveRow.Select
Selection.Delete Shift:=xlUp
Else
ActiveCell.Offset(1, 0).Select
End If



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Conditional row selection

I would use this. This macro will scan down column A, starting in row 2, and
anytime a cell contains "Void" it will delete that row. You can change the
Column if it doesn't fit your application.

Sub DeleteRows()

Dim lngRow As Long

' start on row 2, assume header in row 1
lngRow = 2
Do While Cells(lngRow, "A").Value < ""
If Cells(lngRow, "A").Value = "Void" Then
Rows(lngRow).Delete Shift:=xlUp
End If
lngRow = lngRow + 1
Loop

End Sub

Hope this helps!
--
Cheers,
Ryan


"Vee" wrote:

Thank You - It worked

"Mike H" wrote:

Hi,

Right click your sheet tab, view code and paste this in. Select you data in
column A and run the macro.

Sub merse()
For Each c In Selection
If c.Value = "Void" Then
c.EntireRow.Delete
End If
Next
End Sub

Mike

"Vee" wrote:

I posted this before but can't find it, so here it is again.

I am trying to delete and entire row if column "A" contains "Void". Below
is the code that I have written. It wigs out when I try to select the entire
row.

Do While ActiveCell.Value < ""
If ActiveCell.Value = "Void" Then
ActiveRow.Select
Selection.Delete Shift:=xlUp
Else
ActiveCell.Offset(1, 0).Select
End If

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
Conditional Selection VBA code Himansu Excel Programming 2 March 4th 08 05:02 PM
Conditional Selection [email protected] Excel Worksheet Functions 1 June 5th 07 03:00 AM
Specific Conditional Selection mvyvoda Excel Programming 1 September 8th 06 07:18 AM
Conditional Formatting and selection Kristin N Excel Discussion (Misc queries) 2 September 15th 05 06:27 PM
Conditional column selection Tom Ogilvy Excel Programming 2 July 27th 04 08:34 PM


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