Consulting

Results 1 to 14 of 14

Thread: Modify a macro

  1. #1
    VBAX Contributor
    Joined
    May 2008
    Posts
    109
    Location

    Modify a macro

    Hi All,
    I would ask if it is possible to modify this macro the way it can work always in the same way, in entire column, G in this case, four by four rows, repeatily. In other words, g1->g4, g5->g8, g9->g12 and so on
    Thanks in advance
    sasa

  2. #2
    Site Admin VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,005
    Location
    You will have to explain further as you are using named ranges that aren't dynamic, do you just want to copy the first 4 cells in column A and paste them repeatedly until the end of column G, at the moment your code takes each value one by one and places them in the named range "Input".
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    The code is dynamic, just change the range name definitions

    Allowed: =OFFSET(Sheet1!$A$1,1,0,COUNTA(Sheet1!$A:$A)-1,1)

    Input: =OFFSET(Sheet1!$G$1,0,0,COUNTA(Sheet1!$A:$A)-1,1)
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  4. #4
    Site Admin VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,005
    Location
    Bob, of course he needs that for his named ranges (i thought the code looked like yours!), but he wants do some kind of iteration but without further information we're stuck!
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  5. #5
    VBAX Contributor
    Joined
    May 2008
    Posts
    109
    Location
    Hi all,
    I don't know how I have to use your code, can u be more explicit ?
    I agree with Simon Lloyd but my last question posted in Make Decisions may be not so clear to get any answer.

    Thanks

    sasa
    Last edited by sasa; 06-07-2008 at 11:08 PM.

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    You are already using it in that button, so presumably you know what you are doing, I have no idea, I vaguely remember somthing about populating some values based upon a sequence, I presume allowed is the sequence, input is the values,
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  7. #7
    VBAX Contributor
    Joined
    May 2008
    Posts
    109
    Location

    Good Morning

    Hi All,
    Really, after many efforts, I was not able to find the way to modidfy this macro. The macro is good about my needs, what I ask is if it is possible, after I use this one the first time, so with the output in Column G, if I can put again the input items in column A and leaving the column G unchanged, start the macro again considering the value in G4 the first value of the next sequence that should go from G4 to G7 and so on
    Any help ?

    Thanks

    sasa
    Last edited by sasa; 06-11-2008 at 10:34 PM.

  8. #8
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    As I keep telling you, you don't need to modify the macro for what you wanted. If you have changed the goalposts, tell us in what way.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  9. #9
    VBAX Contributor
    Joined
    May 2008
    Posts
    109
    Location
    No, what I need is exemplified in the attached file I sent in the previous message but I am in difficulty in achieving it. May be what is easy for you is not for me.

    Thanks

    sasa

  10. #10
    Site Admin VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,005
    Location
    You are only working with a static named range, you have not followed xld's advice and made the named ranges dynamic!. You're code looks to see if there is a blank in your named range and if there is fill it with the first value of your list, if a second blank is found fill it with the second value...etc., in your example you mention sequences but no evidence of such - do you just want to copy every set of 4 values from column A to column G?
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  11. #11
    VBAX Contributor
    Joined
    May 2008
    Posts
    109
    Location
    Well, I try to explain what I need
    after I put the first values in any of g1:g4, I need to fill the rows in any of g4 :g7 leaving all the names from g1 to g4 and filling the rows in any g5:g7 with the same mechanism used in any of g1:g4 but changing the order of items from a2 to a5 and so on

    Thanks
    sasa

  12. #12
    Site Admin VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,005
    Location
    You have explained nothing!
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  13. #13
    VBAX Contributor
    Joined
    May 2008
    Posts
    109
    Location
    Ok I surrender

  14. #14
    Site Admin VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,005
    Location
    Make the changes that xld gave then try it and see what the outcome is, you didn't explain what the series in column A would be, adding groups of 4 at the end of data in column G is childsplay!
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

Posting Permissions

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