+ Reply to Thread
Results 1 to 16 of 16

Changing ranges of code

  1. #1
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Changing ranges of code

    I would like to change the entire code so each range will include data from column O. I tried to change the ranges below but I am not sure how to edit the entire code. Can anyone help? Thanks


    Please Login or Register  to view this content.

    Entire Code
    Please Login or Register  to view this content.
    Last edited by rhudgins; 03-18-2011 at 05:15 PM.

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Changing ranges of code

    Hi rhudgins
    consider.. union eg.
    Please Login or Register  to view this content.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Changing ranges of code

    but looking at the sub it maybe better to add two loop to handle the number increase in the ranges and have these two loops run another sub routine.
    I'll have a close look tomorrow.

  4. #4
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Re: Changing ranges of code

    I am not sure how to incorporate your suggestions into my code. I appreciate your help.

  5. #5
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Changing ranges of code

    I was thinking along these lines
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Re: Changing ranges of code

    What would the final complete code look like? I tried making changes without success.

  7. #7
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Changing ranges of code

    rhudgins
    with limited information about what you are doing ...try using
    Please Login or Register  to view this content.

  8. #8
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Changing ranges of code

    There seems to be a pattern in your ranges.
    So no need (even the contrary) do define all those 'constants'.

    Please Login or Register  to view this content.



  9. #9
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Re: Changing ranges of code

    The final code is not working properly. The values in the ranges in column J should be copied to column A on the Tkr Consolidation worksheet and the values in the ranges in column O should be copied to column B on the Tkr consolidation worksheet. Right now the code is copying column J but not copying column O.

    I tried changing this part but it is causing the code to copy a duplicate of column J to column A&B on the Tkr Consolidation sheet.

    Please Login or Register  to view this content.
    Any ideas what I am doing wrong?

  10. #10
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Changing ranges of code

    Hi rhudgins

    This is way to complicated for what you need.but if you want to keep the range constants so it eaiser for you to select ranges thats ok

    but just to copy the ranges to the target work sheet

    Please Login or Register  to view this content.

  11. #11
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Changing ranges of code

    you can't copy non-contiguous ranges.

    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Re: Changing ranges of code

    Thank you. This was over my head and you really helped me out.

  13. #13
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Changing ranges of code

    @sbn
    you will find
    Please Login or Register  to view this content.
    will copy the two ranges

  14. #14
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Changing ranges of code

    rhudgins

    run the code below and it will add the ranges to the first empty cell in target sheet
    Please Login or Register  to view this content.
    and we can work from there

  15. #15
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Changing ranges of code

    @Pike

    Ok.
    My suggestion is using only very basic high school arithmetic.

  16. #16
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Changing ranges of code

    Quote Originally Posted by snb View Post

    [...]

    Please keep in mind that I never give solutions, only suggestions.

    [...]
    ...............................

+ 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