Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You could use a worksheet function:
=countif(a1:a99,"*-inc") You could use it in code, too: dim BegExpRng as long dim BegRng as long dim EndRng as long 'test data begrng = 33 endrng = 66 begexprng = application.countif _ (activesheet.range("a" & begrng & ":A" & endrng), "*-Inc") WLMPilot wrote: I have the following code: begexprng = 0 Range("A" & begrng & ":A" & endrng).Select For Each Cell In Selection If Right(Cell.Value, 4) = "-Inc" Then begexprng = begexprng + 1 Next Cell I am trying to select a group of cells in column A and count the ones that have "-Inc". It should count any cell with either "1-Inc" or "2-Inc" There are other values in column A also. The problem is I am getting a compile error: Next without For. Any ideas? Thanks, Les -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
loop problem | Excel Discussion (Misc queries) | |||
Loop Within a Loop Problem | Excel Programming | |||
Problem adding charts using Do-Loop Until loop | Excel Programming | |||
Loop Problem | Excel Programming | |||
loop problem | Excel Programming |