LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 470
Default Problem with For Each loop

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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
loop problem teepee[_3_] Excel Discussion (Misc queries) 3 December 31st 08 11:09 AM
Loop Within a Loop Problem [email protected] Excel Programming 3 December 5th 07 01:23 PM
Problem adding charts using Do-Loop Until loop Chris Bromley[_2_] Excel Programming 2 May 23rd 05 01:31 PM
Loop Problem Todd Huttenstine Excel Programming 10 April 12th 04 06:15 PM
loop problem joao Excel Programming 4 November 6th 03 02:01 PM


All times are GMT +1. The time now is 06:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"