Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA Output to Excel: Using the range declaration with Chr()

Status
Not open for further replies.

dougez

Technical User
Sep 3, 2002
2
US
I am trying to determine how the following code determines where to put the output in an excel spread sheet. The VBA code is written:

Code:
j=68        
Range(Chr(j) + "22").Select
ActiveCell = G / 1000

I don't understand how the values inside the parentheses following "Range" designate the cell for "G/1000" to be returned in.

The output is in a do-while loop, and the character "j" increments by 1 each time, I am assuming to put the output in a cell one column over(?)after each loop.

Thanks for any help!
 
Chr(65) = "A" 65 is the ASCII Value for "A"
Chr(66) = "B" 66 is the ACSII Value for "B"

The code as indicated, selects cell D22, because CHR(68) = "D"
Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Correct. The output is directed to the cell depicted in the Range(ColumnRow) method. Since Chr(68) returns the ASCII representation "D", the G/1000 result would be placed in the cell described a Column D, Row 22. The loop increments the value parameter for the Chr() function and return the next letter in the alphabet ("E") which is used by the range method to place the next G/1000 result in the next column (E22). And so on...

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top