+ Reply to Thread
Results 1 to 10 of 10

Enumerate through one range and add a value to an adjacent range on the same row

  1. #1
    Registered User
    Join Date
    11-19-2012
    Location
    Quantico, VA
    MS-Off Ver
    Excel 2013
    Posts
    74

    Enumerate through one range and add a value to an adjacent range on the same row

    So I'm a newby at VBA and almost a guru at excel but I'm getting my tale handed to my trying to figure this stuff out.

    How it supposed to work: I have data added to one row by the user. They Select some general settings. And hit submit.

    What I imagine VBA doing is: Enumerating through the first column of new rows of data and if a value is present it adds a value to 5 different columns on the same row. It does this for all rows with data in the first column of the range the user is adding data to.

    Whats actually happening: Nothing.

    Here is the code I'm using.

    Please Login or Register  to view this content.
    Help Please!


    Moderator's Note: You have to put code tags around codes. Select the code then hit the "#" sign. I'll do it for you this time. Thanks.
    Last edited by vlady; 01-15-2013 at 07:37 PM. Reason: code tags

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Enumerate through one range and add a value to an adjacent range on the same row

    Hi

    Firstly, can you please edit your post and put your code in code tags.


    Then post an example file that has all the relevant named ranges, some example data, and show what result you would expect to achieve.

    rylo

  3. #3
    Registered User
    Join Date
    11-19-2012
    Location
    Quantico, VA
    MS-Off Ver
    Excel 2013
    Posts
    74

    Re: Enumerate through one range and add a value to an adjacent range on the same row

    My first post. I wondering how that was done. Here is an example file. Thanks for looking into this.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Enumerate through one range and add a value to an adjacent range on the same row

    Hi

    In step 4, you suddenly have mycell. This doesn't appear to be set anywhere.

    Can you explain exactly what you want to happen, and as I requested in #2, show what results you would expect to achieve.

    rylo

  5. #5
    Registered User
    Join Date
    11-19-2012
    Location
    Quantico, VA
    MS-Off Ver
    Excel 2013
    Posts
    74

    Re: Enumerate through one range and add a value to an adjacent range on the same row

    The end result shows the area on the left filled in.
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Enumerate through one range and add a value to an adjacent range on the same row

    Hi

    From what you have given me, something simplier would suffice.

    Please Login or Register  to view this content.
    rylo
    Last edited by rylo; 01-15-2013 at 10:08 PM.

  7. #7
    Registered User
    Join Date
    11-19-2012
    Location
    Quantico, VA
    MS-Off Ver
    Excel 2013
    Posts
    74

    Re: Enumerate through one range and add a value to an adjacent range on the same row

    Can I place the static values to refer back to those values as range? Reason being the user will actually uses a drop down list and what ever values is in that box will end up on the left.

  8. #8
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Enumerate through one range and add a value to an adjacent range on the same row

    Hi

    The example files don't actually have all the nominated ranges included, so I used the fixed ranges. I'm guessing that the range names would only refer to a single cell, so unless you are planning on moving the position of those cells, then you could use the fixed ranges just as easily as named ranges.

    rylo

  9. #9
    Registered User
    Join Date
    11-19-2012
    Location
    Quantico, VA
    MS-Off Ver
    Excel 2013
    Posts
    74

    Re: Enumerate through one range and add a value to an adjacent range on the same row

    Your amazing! Thank you so much. Do you recommend any books to better understand the logic behind the code structure. I can't wait to be as good as you are at communicating with Excel in VBA.

  10. #10
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Enumerate through one range and add a value to an adjacent range on the same row

    Hi

    Thanks. Re the learning materials, have a look at the sticky at the top of the programming forum. Have a look there for some references. Also, one of the best resources is to have a look at the posts and their solutions. That way you have an example and a way of achieving the results so you can work through some concrete things to get experience.

    rylo

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1