Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Matilda Hughes   on Mar 24 In MS Office Category.

  
Question Answered By: Dannon Jones   on Mar 24

In VBA and most programming languages, you cannot just say "If x = 0 or
2", you must say "If x = 0 or x = 2", therefore your line should read:

If Application.WorksheetFunction.CountA(Rows(r)) = 0 Or _
Application.WorksheetFunction.CountA(Rows(r)) = 2 _

Or you could store the value in a variable first if you were really
concerned about performance:

Dim intNumCells As Integer
intNumCells = Application.WorksheetFunction.CountA(Rows(r))
If intNumCells = 0 Or IntNumCells = 2 ...

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on deleting rows Or get search suggestion and latest updates.


Tagged: