[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[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!

4.6

VBA Syntax

Asked by Debsyl99 in Microsoft Excel Spreadsheet Software

Tags: vba, syntax

Hi
I have the following code that checks a range on a spreadsheet and copies the value into a specific cell in another range. This works fine except if I run it more than once. What I need to do is first set the value of O to "" for each cell in the range Results. The range PTable is also very long as it can have a variable number of values in the range. I need the function to stop when it reaches a value on Ptable that's empty ie "".

Sub EnterRisk()
    Dim O As Range
    For Each cell In Range("PTable")
        P = cell
        I = cell.Offset(0, 1)
        R = cell.Offset(0, -2)
        Set O = WorksheetFunction.Index(Range("Results"), 7 - I, P)
        If O = "" Then
            O = R
        Else
            O = O & "," & R
        End If
    Next cell
End Sub

I've managed to set the value of each cell in the Range results to "" by using the following code - but it looks clunky

Sub EnterRisk()
    Dim O As Range
    For Each cell In Range("PTable3")
        P = cell
        I = cell.Offset(0, 1)
        R = cell.Offset(0, -2)
        Set O = WorksheetFunction.Index(Range("Results"), 7 - I, P)
        O = ""
        Next cell
        For Each cell In Range("PTable3")
        P = cell
        I = cell.Offset(0, 1)
        R = cell.Offset(0, -2)
        Set O = WorksheetFunction.Index(Range("Results"), 7 - I, P)
        If O = "" Then
            O = R
        Else
            O = O & "," & R
        End If
    Next cell
End Sub

However I'm not having any luck with the syntax to check the value of of p and only execute the code to assign value to O if P is <>"". I also need to run this code across two different worksheets - at the moment it runs off the same worksheet. So -  the ranges "Range" and "PTable" will be on separate worksheets.

Can someone help? I hope I've explained that clearly enough.
Thanks
Deb
 
Related Solutions
Keywords: VBA Syntax
 
Loading Advertisement...
 
[+][-]09/18/06 04:46 AM, ID: 17542513Expert Comment

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 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/18/06 04:47 AM, ID: 17542524Expert Comment

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 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/18/06 04:55 AM, ID: 17542588Author Comment

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 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/18/06 05:15 AM, ID: 17542748Expert Comment

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 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/18/06 05:19 AM, ID: 17542770Author Comment

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 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/18/06 05:28 AM, ID: 17542841Expert Comment

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 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/18/06 05:40 AM, ID: 17542919Author Comment

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 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/18/06 06:12 AM, ID: 17543153Expert Comment

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 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/18/06 06:20 AM, ID: 17543212Author Comment

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 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/18/06 06:39 AM, ID: 17543382Expert Comment

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 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/18/06 07:05 AM, ID: 17543574Author Comment

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 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/18/06 07:11 AM, ID: 17543623Expert Comment

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 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/18/06 07:13 AM, ID: 17543641Author Comment

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 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/18/06 07:14 AM, ID: 17543651Accepted Solution

View this solution now by starting your 30-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: Microsoft Excel Spreadsheet Software
Tags: vba, syntax
Sign Up Now!
Solution Provided By: ManAlive
Participating Experts: 1
Solution Grade: A
 
[+][-]09/18/06 07:34 AM, ID: 17543791Author Comment

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 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/18/06 07:38 AM, ID: 17543836Expert Comment

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 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/18/06 07:53 AM, ID: 17543950Author Comment

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 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/18/06 08:02 AM, ID: 17544038Expert Comment

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 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/18/06 08:04 AM, ID: 17544064Author Comment

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 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/18/06 08:12 AM, ID: 17544144Expert Comment

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 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/18/06 08:29 AM, ID: 17544286Author Comment

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 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81