Advertisement

08.05.2006 at 06:15AM PDT, ID: 21944376
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.0

VBA code to convert a number into a string

Asked by burk78 in Miscellaneous Software

Tags: , , ,

Hello,

I have an urgent question regarding Excel VBA. I have a Macro which is supposed to convert the numbers entered in sheet Inputs!C3 (and ranging between 1 & 180) into column headers, starting from Column B to Column 182; eg if I enter 25, the Macro correctly converts it into the letter Z (i.e. the 26th letter, since I want it to start counting from "B"), if I enter 55 in cell C3 of sheet Inputs, the macro converts it into the string BD

The string is then used by a formula to define a range

Sub RandomNumbers()
Sheets("Inputs").Calculate
Dim m As String
z = Sheets("Inputs").Range("C3").Value

If z <= 26 Then
m = Chr(65 + z)
ElseIf z <= 52 Then
m = "A" & Chr(65 + (z - 26))
ElseIf z <= 78 Then
m = "B" & Chr(65 + (z - 2 * 26))
ElseIf z <= 104 Then
m = "C" & Chr(65 + (z - 3 * 26))
ElseIf z <= 130 Then
m = "D" & Chr(65 + (z - 4 * 26))
ElseIf z <= 156 Then
m = "E" & Chr(65 + (z - 5 * 26))
ElseIf z <= 182 Then
m = "F" & Chr(65 + (z - 6 * 26))
End If

k = Range("Inputs!C14").Value

For i = 2 To k + 1
    Range("B" & i & ":" & m & i).FormulaArray = "=TRANSPOSE(RandBM(Inputs!R3C3))"
Next i
   
End Sub

The problem now is as follows: the Macro works fine for any values between 1 & 182 EXCEPT for multiples of 26:
i.e. every time I insert 26, 52,78, 104, 130, 156, 182, in cell C3 of sheet inputs, the Macro returns following error message:

"Run-time error '1004',

Method 'Range of Object_Global' failed"

The Debugger then highlights the following line of the Macro, which refers to the Range :

    Range("B" & i & ":" & m & i).FormulaArray = "=TRANSPOSE(RandBM(Inputs!R3C3))"

Apparantly, the Macro as it is cannot convert any multiples of 26 into the corresponding characters (for instance, 26 is supposed to be converted into AA, 52 into BA etc) ...any help on how to solve this issue would be greatly appreciated!

Many thanx!
Burki Start Free Trial
[+][-]08.05.2006 at 10:48AM PDT, ID: 17256594

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.05.2006 at 10:52AM PDT, ID: 17256602

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.05.2006 at 11:20AM PDT, ID: 17256676

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.05.2006 at 01:31PM PDT, ID: 17256963

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.05.2006 at 01:41PM PDT, ID: 17256995

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.05.2006 at 01:44PM PDT, ID: 17256998

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.05.2006 at 08:33PM PDT, ID: 17257607

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.06.2006 at 12:38AM PDT, ID: 17257948

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.06.2006 at 12:40AM PDT, ID: 17257952

View this solution now by starting your 14-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Miscellaneous Software
Tags: vba, string, convert, number
Sign Up Now!
Solution Provided By: GrahamSkan
Participating Experts: 3
Solution Grade: A
 
 
[+][-]08.06.2006 at 01:13AM PDT, ID: 17258045

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.06.2006 at 01:18AM PDT, ID: 17258068

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.06.2006 at 01:20AM PDT, ID: 17258080

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.06.2006 at 08:56AM PDT, ID: 17259140

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.06.2006 at 09:59AM PDT, ID: 17259342

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.06.2006 at 10:17AM PDT, ID: 17259395

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.06.2006 at 02:22PM PDT, ID: 17260145

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.06.2006 at 05:54PM PDT, ID: 17260748

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-43