Deleting rows based on cell criteria

J

jgranda

I would like to write a macro that takes a standard output file into a new file that can be used by a software package that requires a slightly different file. I am a novice VB programmer

The hurdle I would like to solve is removing rows of data that must be removed. I know the rows I want to eliminate since they all have the value "Credit Rating: Foreign Currency" in column B. What is the best way to remove these rows

BTW, these are generally small files of less than 500 records

Thanks...Joe
 
R

RSnyder

If everyline has something in it on the column B cell use this otherwise you a terminating value to no when this would terminate

Worksheet("worksheet name").Activat
If moCurrCell.Value = "Credit Rating: Foreign Currency" The
Selection.EntireRow.Delet
Set CurrLine = Range("B1"
Set NextLine = CurrLine.Offset(0, 1
CurrLine.Selec
D
If CurrLine.Value = "Credit Rating: Foreign Currency" The
Selection.EntireRow.Delet
End I
Set CurrLine = NextLin
Set NextLine = CurrLine.Offset(0, 1
CurrLine.Selec
Loop Until CurrLine.Value = "

Change "Loop Until CurrLine. Value = " comparison of "" to "xx" if you know that the last line has an "xx" in it.
 
Top