+ Reply to Thread
Results 1 to 55 of 55

generate multiple rows with vba

  1. #1
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    generate multiple rows with vba

    kindly view the attachment and help in my project

    regards
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,065

    Re: generate multiple rows with vba

    I think you need to do a whole lot more explaining before anyone can help you on this. Also, it's poor form to force someone to open a file to have any idea of what you're needing help with.

  3. #3
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    sir you are quite right but to elaborate it will be very long and in excel in sheet1 there is data and in sheet2 there is result

    Plz see once ..it has been elaborated too easily

  4. #4
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    There are so many experts here who have always helped me-kindly assist

    its a very small job for you -i know

  5. #5
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba with respect to value of a column

    changed the title for better understanding

  6. #6
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    Kindly assist if i should do somehing kindly tell me

  7. #7
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    sir

    why i am not getting the reply cant understand ...kindly help

  8. #8
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,065

    Re: generate multiple rows with vba

    I would recommend you start a new thread. In your first post, fully describe the issue you're asking for help with (spend some time and effort getting this part right. if a reader doesn't understand what you want, he won't respond to your post in most cases). Second, post a workbook showing what you're wanting to go from and what you want it to look like after. If it's not obvious how to go from beginning to end (in other words, if there are rules regarding the arrangement of the data, or calculations needed) make sure you document this so the reader understands what's needed.

    Again, to emphasize, IF you don't explain what you're wanting to do, most folks won't respond to your post.

  9. #9
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,065

    Re: generate multiple rows with vba

    Deleted:Dupe post
    Last edited by jomili; 09-27-2016 at 12:21 PM.

  10. #10
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,065

    Re: generate multiple rows with vba

    Deleted; dupe post

  11. #11
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    ok sir i will start a new thread

  12. #12
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    there are so many experts and gurus on vba and other forums kindly help...

    before a start a new one

  13. #13
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: generate multiple rows with vba

    Maybe:

    Please Login or Register  to view this content.

  14. #14
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    thank you very much sir i will try and reply you soon...

  15. #15
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    thank God

    you have responded sir,the code is working absolutely as i wanted. some facts i would like to share with you regarding this code

    its giving value as 20*25

    where as in those cell i needed the multiplied value i.e 500 and likewise in cells where values with "*" are coming i need multiplied valuee sir

    second thing the code is also generating a row for corresponding zero value against codes like it is generating for code 19 in column g where as if against any code in any column zero is there our vba code should not generate row against such colum(purticular cell) for other cell it should generate.

    the code is also generating an extra row for last code 19? which is not required

    i have added to more columns for " eligibilty for Lunch" and eligibilty for Entertainment -kindly adjust the vba code to generate rows against them also

    for output attaching the sample file again.

    Thanking you in advance

    Because of people like you this forum is Great!!!!

  16. #16
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    new sample with added two columns rest it is same as previous one
    Attached Files Attached Files

  17. #17
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    uploading a new sample with two new added columns rest it is same as previous one

    regards
    Attached Files Attached Files

  18. #18
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    HTML Code: 
    Kindly assisst for modification of code -new sample attached sir...

  19. #19
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    Let it generate rows for corresponding zero columns also kindly just modify the code as i have addedd two more columns and it is generating an extra last code kindly correct that also

  20. #20
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: generate multiple rows with vba

    Try:

    Please Login or Register  to view this content.

  21. #21
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    This is fine but still it is giving value as 20*25 where as it should give multiplied value as a result in that cell that is 500 as a result

  22. #22
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: generate multiple rows with vba

    Modified:

    Please Login or Register  to view this content.

  23. #23
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    sir this code is giving multiplied value of petrol for one code only

    for every code i want the same result sir..

    dont need * any where for petrol, i need the multiplied value for every code sir

    and when i am increasing records by adding rows of new employee it is not generating result for subsequent rows

  24. #24
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    Yes your modified code is working fine now but it is not clearing old data in sheet2 before writting which is creating problem

  25. #25
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: generate multiple rows with vba

    One last attempt:

    Please Login or Register  to view this content.
    Last edited by JOHN H. DAVIS; 10-05-2016 at 02:55 PM.

  26. #26
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    Thank you very much sir

    you did it

    but kindly consider one last request

    if value in column d is more than 100 then in place of multiplied values like 20*25 the result should be only that d column value not the multiplied value(this shall be followed for entire d column and the result)

    rest of the function of vba shall remain same

    one last time i am requesting for modification

    plz do it for me
    Last edited by ROHAN999; 10-06-2016 at 10:42 PM.

  27. #27
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    somebody kindly assisst

  28. #28
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: generate multiple rows with vba

    Column d??

  29. #29
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    In which column the eligibility of petrol is there sir

    if the eligibility is more than or equal to 100 then in result instead of multiplied value with petrol rate -only the eligibility of petrol should come as result

  30. #30
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    sir am i not clear -should i explain anythingels

  31. #31
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: generate multiple rows with vba

    http://www.excelforum.com/excel-prog...-a-column.html
    Please Login or Register  to view this content.
    Last edited by jindon; 10-09-2016 at 01:46 AM.

  32. #32
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    sir

    it is giving runtime error 5

    invalid procedure call or argument

  33. #33
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    for
    b(n, 3) = UCase$(Split(Mid$(a(2, ii), x), "(")(0) & " of " & myMonth)

  34. #34
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    sir now i was able to use this code but your code is giving me the result with multiplied values only where as the requirment is that if the petrol eligibilty is more than 100 then the result in sheet 2 should not be the multiplied value with rate of petrol it should be only eligility of petrol


    rest formula should function the same

  35. #35
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    HTML Code: 
    this code was working fine

    only it was not clearing the old data in sheet2 before writting new one

    and the above stated problem is there with this formula also

  36. #36
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: generate multiple rows with vba

    You should show us exact results that you want.

    Change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  37. #37
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    ok uploding a sample soon

  38. #38
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: generate multiple rows with vba

    These lines clear the old data in Sheet2 before the other processes are run.

    Please Login or Register  to view this content.

  39. #39
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    Sheet 1 is data sheet2 is result sir
    Attached Files Attached Files

  40. #40
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    John sir your code is doing everything except one thing that is if the value in column for eligibilty of petrol is more than 100 than in sheet 2 in result should be the only eliglibility not the multiplied valued

  41. #41
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: generate multiple rows with vba

    Can you confirm that what you have in your sample in Sheet2 is the results that you actually want?? It is confusing. You're saying that you want a multiplied value. Then your sheet2 should have that multiplied values as a result. Does this help?

    Please Login or Register  to view this content.

  42. #42
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: generate multiple rows with vba

    Still not clear to me
    Please Login or Register  to view this content.
    Last edited by jindon; 10-11-2016 at 08:31 AM.

  43. #43
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    yes sir sheet 2 is result

    the code which you have pasted gives multiplied values for all the clomns value

    were as the multiplied values are required only for column eligibility of petrol
    rest of the values of other columns will go as it to sheet2 as a result-but if any value in column eligibility for petrol is more than 100 the it should go as it is in sheet2 as a result

    for example if value in column eligibilty for petrol is 10 then the result in sheet2 in respective column will be 25*10 that is 250 finally as result but suppose if value in column eligibilty for petrol is 200 then in sheet2 result should not be 200*25 it should be only 200 that is what i wanted to say

    HTML Code: 
    this code was working fine

    it was just not doing the above

  44. #44
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    fpr jindon sir

    runtime error 13

    type mismatch for b(n, 4) = a(i, ii) * IIf(a(i, ii) < 100, a(i, UBound(a, 2)), 1)

  45. #45
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: generate multiple rows with vba

    Did you try the code in Post 41?

  46. #46
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: generate multiple rows with vba

    Maybe like this ?

    Please Login or Register  to view this content.
    Kind regards
    Leo

  47. #47
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: generate multiple rows with vba

    Quote Originally Posted by ROHAN999 View Post
    fpr jindon sir

    runtime error 13

    type mismatch for b(n, 4) = a(i, ii) * IIf(a(i, ii) < 100, a(i, UBound(a, 2)), 1)
    Is something wrong with your Excel?
    Attached Files Attached Files

  48. #48
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    Yes sir i have tried post 41 ,its absolutely fine also taking care of >100 condition also

    but there is only one problem with this code

    it is giving multiplied valued for all columns like petrol, mobile , entertain etc etc..

    Where as the multiplied values are only required for the eligilbility for petrol

  49. #49
    Forum Contributor S O's Avatar
    Join Date
    06-25-2015
    Location
    England
    MS-Off Ver
    Office 2010 + 2013 + 2016
    Posts
    103

    Re: generate multiple rows with vba

    just an FYI:

    but to elaborate it will be very long
    People generally won't bother giving their own free time to help if they see you aren't willing to give your time to explain. This is probably why you didn't get a response for so long.

    Maybe that will help you in future.

  50. #50
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    leo your code is doing all but the narration are wrong - it should come like petrol for the month of sep 16....like wise

  51. #51
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    kindly see in sheet2 the narrations are changed than that of in sheet1 as when the eligibility is multiplied with value of petrol@ then the result value will not remain eleigibility

    so in result sheet2 narration have been changed

    in john sir code narrations are coming correct

    leo-except narration issue your code is doing everything else

  52. #52
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: generate multiple rows with vba

    Quote Originally Posted by ROHAN999 View Post
    Yes sir i have tried post 41 ,its absolutely fine also taking care of >100 condition also

    but there is only one problem with this code

    it is giving multiplied valued for all columns like petrol, mobile , entertain etc etc..

    Where as the multiplied values are only required for the eligilbility for petrol
    OK Then:

    Please Login or Register  to view this content.

  53. #53
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    736

    Re: generate multiple rows with vba

    Thank you sir

  54. #54
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: generate multiple rows with vba

    You're welcome. Glad to help out and thanks for the feedback and the reps.

  55. #55
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: generate multiple rows with vba

    Because the file in #1 contains 8 colums and later onother file with 10 columns

    this one can handel both

    Please Login or Register  to view this content.
    Kind regards
    Leo

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 02-16-2016, 07:51 PM
  2. Macro to generate Outlook emails with data/information from multiple rows of data
    By dasbrutalz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-30-2014, 07:34 PM
  3. [SOLVED] Generate multiple invoices fetching data from rows of a sheet
    By devang.vakharia in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-12-2013, 08:14 AM
  4. Replies: 2
    Last Post: 09-29-2010, 03:28 PM
  5. Generate List of Matching Rows from multiple tabs
    By xenocide8d in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 03-02-2010, 12:52 AM
  6. generate multiple rows based on cell value
    By Theresa in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-25-2005, 06:21 PM

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