![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Feb 2005
Posts: 13
Rep Power: 0
![]() |
ASCII conversion loop difficulty
I am having a problem with my ASCII conversion and having these values inside a loop.
The values start out below as: tempCol = 67 (which is the ASCII value for 'C') iTotalCols = 46 (which is the number of columns I have in the sheet) iColour is just a Integer The problem i am experiancing is that when the loop gets to 91, which is [ (left/opening bracket) - i get an error. How can i stop this? I have this loop structure: For n = tempCol To iTotalCols + 64 sRange = Chr(n) & m If Trim$(Range(sRange).Text) <> "" Then Range(sRange).Interior.ColorIndex = iColour End If Next n Thanks. Picco |
|
|
|
|
|
#2 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
What's the error?
|
|
|
|
|
|
#3 |
|
Expert Programmer
|
You're intending to go A B C ... to iterate through the columns of some sort of table right? However, when you get to [ it throws an error because that is actually a character used in expressing a range (a vector in fact) and isn't a letter.
What you need to do is to then go AA AB AC... BA BB BC... if you plan to go above 26 columns. Hope that helps. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|