delete part of a row based on certain criteria

M

mark lane

i have a spreadsheet on jobs estimated. i have columns a to g to input
data into. in columns h ai i have formulas for this data. i have
formulas in 2000 rows (and i need this many rows). in column g, if the
job has been closed, we put an "x" in that column. i would like to
delete this row automatically without filtering and deleting it
manualy. i only need to delete a to g in this row and leave h through
ai (because these have formulas in them). can you please help me. i
believe there is a way to use vba but i'm not really all that familar
with it. please help somebody asap!!!!

thanks and GOD bless,

mark lane
 
S

Samuel

Hi Mark,

please try this and see if this works

Sub PartDelete()
Range("G1").Select
For I = 1 To 2000
If ActiveCell.Value = "x" Then
ActiveCell.Offset(0, -6).Select
Range(Selection, Selection.End(xlToRight)).Clear
ActiveCell.Offset(0, 6).Select
Else
ActiveCell.Offset(1, 0).Select
End If
Next I
End Sub
Try out this.
 
M

mark lane

Samuel said:
Hi Mark,

please try this and see if this works

Sub PartDelete()
Range("G1").Select
For I = 1 To 2000
If ActiveCell.Value = "x" Then
ActiveCell.Offset(0, -6).Select
Range(Selection, Selection.End(xlToRight)).Clear
ActiveCell.Offset(0, 6).Select
Else
ActiveCell.Offset(1, 0).Select
End If
Next I
End Sub
Try out this.


thanks Samuel,

i will try this at work tomorrow. i appreciate your help. i have
another question. how do i get this to run as soon as the worksheet is
opened and keep running until it's closed? please help.

thanks and GOD bless,

Mark Lane
 
Top