Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default delete row with criteria (vba)

hi all,

i have 2 questions,


i need a code that will delete some rows if there a "x" in column a.

if there a "x" at a25 .. i want the macro to delete c25, f25 aa25

but i want the macro to be multirange like "x" in those cells a15,a16,
a159 ,ect. a"z"
where the macro will delete c"z", f"z", aa"z"



next question.

in the same order of idea,

is it possible to highlight a range of row with the mouse and run the
macro.

so if u highlight row 5:10 the macro will delete c 5:10 f
5:10 aa:25.

if it is possible that the macro run whatever the highligth is like
a5:a10 or af5:af10 that will still run.


ty

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default delete row with criteria (vba)


wrote in message
ups.com...
hi all,

i have 2 questions,


i need a code that will delete some rows if there a "x" in column a.

if there a "x" at a25 .. i want the macro to delete c25, f25 aa25

but i want the macro to be multirange like "x" in those cells a15,a16,
a159 ,ect. a"z"
where the macro will delete c"z", f"z", aa"z"



For i = 1 To Cells(Rows.Count,"A").End(xlUp).Row
If Cells(i,"A").Value = "x" Or cells(i, "A").Value = "z" Then
Cells(i,"C").ClearContents
Cells(i,"F").ClearContents
Cells(i,"AA").ClearContents
End If
Next i


next question.

in the same order of idea,

is it possible to highlight a range of row with the mouse and run the
macro.

so if u highlight row 5:10 the macro will delete c 5:10 f
5:10 aa:25.

if it is possible that the macro run whatever the highligth is like
a5:a10 or af5:af10 that will still run.



For Each cell In Selection.Columns(1).Cells
If cell.Value = "x" Or cell.Value = "z" Then
cell.Offset(0,2).ClearContents
cell.Offset(0,5).ClearContents
cell.Offset(0,26).ClearContents
End If
Next i


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default delete row with criteria (vba)

ty bob




Bob Phillips wrote:
wrote in message
ups.com...
hi all,

i have 2 questions,


i need a code that will delete some rows if there a "x" in column a.

if there a "x" at a25 .. i want the macro to delete c25, f25 aa25

but i want the macro to be multirange like "x" in those cells a15,a16,
a159 ,ect. a"z"
where the macro will delete c"z", f"z", aa"z"



For i = 1 To Cells(Rows.Count,"A").End(xlUp).Row
If Cells(i,"A").Value = "x" Or cells(i, "A").Value = "z" Then
Cells(i,"C").ClearContents
Cells(i,"F").ClearContents
Cells(i,"AA").ClearContents
End If
Next i


next question.

in the same order of idea,

is it possible to highlight a range of row with the mouse and run the
macro.

so if u highlight row 5:10 the macro will delete c 5:10 f
5:10 aa:25.

if it is possible that the macro run whatever the highligth is like
a5:a10 or af5:af10 that will still run.



For Each cell In Selection.Columns(1).Cells
If cell.Value = "x" Or cell.Value = "z" Then
cell.Offset(0,2).ClearContents
cell.Offset(0,5).ClearContents
cell.Offset(0,26).ClearContents
End If
Next i


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
How to Delete row with criteria ? vumian[_4_] Excel Programming 16 July 27th 06 02:47 PM
How to Delete row with criteria ? vumian[_2_] Excel Programming 1 July 26th 06 04:28 AM
How to Delete row with criteria ? vumian[_3_] Excel Programming 0 July 19th 06 04:54 PM
Delete rows with different criteria John Excel Programming 7 July 13th 05 05:38 PM
Further help on delete criteria found rjamison Excel Programming 0 June 14th 05 12:14 AM


All times are GMT +1. The time now is 05:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"