Deleting rows based on cell criteria

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top