Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Looping Issues

I've set up a collection of specific worksheets that I'm doing similar
calculations on, and I cycle through each of them using a For
Each....Next Loop. My problem is that occassionally when I cycle
through this process, the loop doesn't seem to end when it's supposed
to. For example, I'm using the following process to add conditional
formatting to each of my selected worksheets.

For Each sh In Collect
With sh.Range("T2:AB" &
intSystems).FormatConditions.Add(xlCellValue, xlEqual, 1)
.Interior.Color = 65280
End With
Next

Where intSystems is a row number (26), and Collect is my collection.

Instead of adding this formatting once to each of my worksheets, it
adds the formatting about 10 times to each sheet.

If anybody has any ideas about causes or solutions I'd really
appreciate it. I'm having compatibility issues when I open this
workbook in older Excel versions.

-bgetson

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Looping Issues

The code is searching range T2:AB26 for the value of 1. The one could be
part of the number such as 126, 12, or 1

" wrote:

I've set up a collection of specific worksheets that I'm doing similar
calculations on, and I cycle through each of them using a For
Each....Next Loop. My problem is that occassionally when I cycle
through this process, the loop doesn't seem to end when it's supposed
to. For example, I'm using the following process to add conditional
formatting to each of my selected worksheets.

For Each sh In Collect
With sh.Range("T2:AB" &
intSystems).FormatConditions.Add(xlCellValue, xlEqual, 1)
.Interior.Color = 65280
End With
Next

Where intSystems is a row number (26), and Collect is my collection.

Instead of adding this formatting once to each of my worksheets, it
adds the formatting about 10 times to each sheet.

If anybody has any ideas about causes or solutions I'd really
appreciate it. I'm having compatibility issues when I open this
workbook in older Excel versions.

-bgetson


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Looping Issues

The only possible values for the selected cells are a 1 or a 0. The
problem isn't that the conditional formatting is giving false
positives. My problem is that the visual basic applies 10 versions of
the same conditional formatting to each cell.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Looping Issues

This is conditional formating. Each cell is independantly given this
conditional formating. You have 25 rows (rows 2 to 26) and 9 (T to AB)
columns, Therefore the condtion is being placed in 225 cells on each
worksheet.

There can only be three different condtional formating in each cell so I
don't know how you are getting 10.



" wrote:

The only possible values for the selected cells are a 1 or a 0. The
problem isn't that the conditional formatting is giving false
positives. My problem is that the visual basic applies 10 versions of
the same conditional formatting to each cell.


Reply
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
Display issues vronron Excel Discussion (Misc queries) 4 August 23rd 07 04:29 PM
Issues with Looping macro...Do Until TextBox7.Value = 0 but it's crashing...Why? [email protected] Excel Programming 3 March 19th 07 03:32 AM
Issues with VBA Chris Excel Programming 3 November 3rd 06 06:42 PM
C# VBA DLL issues Temporalis Excel Programming 5 October 20th 06 10:49 PM
need help for several issues bandy2000 Excel Programming 2 March 15th 05 02:11 AM


All times are GMT +1. The time now is 05:55 AM.

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"