Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 3rd, 2005, 5:46 AM   #1
crmpicco
Newbie
 
Join Date: Feb 2005
Posts: 13
Rep Power: 0 crmpicco is on a distinguished road
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
crmpicco is offline   Reply With Quote
Old May 3rd, 2005, 11:27 AM   #2
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
What's the error?
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old May 3rd, 2005, 1:55 PM   #3
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
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.
Rory is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:01 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC