+ Reply to Thread
Results 1 to 23 of 23

Inserting Rows with Specific Data in Multiple Designated Locations

  1. #1
    Registered User
    Join Date
    01-24-2014
    Location
    Scottsdale
    MS-Off Ver
    Excel 2013
    Posts
    35

    Inserting Rows with Specific Data in Multiple Designated Locations

    Customer Profilesv4 - Paul 7.24.14.xlsx

    In the CurrentCustomer WS, Column B is "Commodity", I need to insert a new row for the commodity "Red Kale" between rows 6 & 7 repeating every 23 rows down to 446 & 447. Is there a simple way to do this without manually copying and inserting every row manually?

    Thanks,

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Inserting Rows with Specific Data in Multiple Designated Locations

    Hi ExcelDummy

    This can be done with VBA Code. Do you need to do the same for DevelopingCustomers?

    Will this be a tool you'll need to use again for additional Commodities?
    Last edited by jaslake; 08-09-2014 at 01:44 PM.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Registered User
    Join Date
    01-24-2014
    Location
    Scottsdale
    MS-Off Ver
    Excel 2013
    Posts
    35

    Re: Inserting Rows with Specific Data in Multiple Designated Locations

    Jadlake,

    Thanks for the response. This will need to be done on DevelopingCustomers and yes it would be a tool I would use again when adding additional commodities.

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Inserting Rows with Specific Data in Multiple Designated Locations

    Hi ExcelDummy

    Let me play with it a bit...see what I can come up with.

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Inserting Rows with Specific Data in Multiple Designated Locations

    Hi ExcelDummy

    Create a Test Folder...place both of the attached Workbooks in that Test Folder. Open the TestBook v1.1.xlsm. Click the Button.

    The Code will ask you which Customer Profile Workbook you wish to modify. Select that Workbook (only one in this Test Folder...Customer Profilesv4 - Paul 7.24.14.xlsx)

    The Code will then ask you to select the Row ABOVE which you wish to Insert a New Commodity. It'll further ask you to Name the New Commodity.

    This Code is in TestBook and can be run on any Customer Profile Workbook that's of the SAME STRUCTURE.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    01-24-2014
    Location
    Scottsdale
    MS-Off Ver
    Excel 2013
    Posts
    35

    Re: Inserting Rows with Specific Data in Multiple Designated Locations

    Jaslake,

    Thanks, but I keep getting a runtime error 13 - type mismatched?

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Inserting Rows with Specific Data in Multiple Designated Locations

    Hi ExcelDummy

    On what line of Code
    runtime error 13 - type mismatched

  8. #8
    Registered User
    Join Date
    01-24-2014
    Location
    Scottsdale
    MS-Off Ver
    Excel 2013
    Posts
    35

    Re: Inserting Rows with Specific Data in Multiple Designated Locations

    Here is the highlighted code line from the debug screen:
    YesNo = MsgBox(nCell & " will be inserted before every occurance " & rCell, vbYesNo + vbCritical)

  9. #9
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Inserting Rows with Specific Data in Multiple Designated Locations

    Hi ExcelDummy

    Are you using the Files I uploaded or different Files?

  10. #10
    Registered User
    Join Date
    01-24-2014
    Location
    Scottsdale
    MS-Off Ver
    Excel 2013
    Posts
    35

    Re: Inserting Rows with Specific Data in Multiple Designated Locations

    I followed your instructions above, created the test folder on my desktop, downloaded the attached files into the test folder, then ran the testbook file.

  11. #11
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Inserting Rows with Specific Data in Multiple Designated Locations

    Hi ExcelDummy

    I modified the Code slightly but of little consequence/significance. I see you're using Excel 2013 and I have no access to that. On my platform the Code performs as expected in both Excel 2007 and 2010.

    Replace the TestBook v1.1.xlsm with the attached...let me know.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    01-24-2014
    Location
    Scottsdale
    MS-Off Ver
    Excel 2013
    Posts
    35

    Re: Inserting Rows with Specific Data in Multiple Designated Locations

    Still getting the same runtime error. Maybe its a difference in the excel versions? Thanks for trying. I don't want you to have to spend anymore time on this if you don't want.

    Thanks,

  13. #13
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Inserting Rows with Specific Data in Multiple Designated Locations

    Hi ExcelDummy

    Are you using Excel 2013?

  14. #14
    Registered User
    Join Date
    01-24-2014
    Location
    Scottsdale
    MS-Off Ver
    Excel 2013
    Posts
    35

    Re: Inserting Rows with Specific Data in Multiple Designated Locations

    Yes, I am using Excel 2013

  15. #15
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Inserting Rows with Specific Data in Multiple Designated Locations

    Alright...I'll try to get some help from a Member that has access to 2013...

  16. #16
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Inserting Rows with Specific Data in Multiple Designated Locations

    just for test purpose change the DIM for Response to Variant and see what that does
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  17. #17
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Inserting Rows with Specific Data in Multiple Designated Locations

    Hi ExcelDummy

    The Code in the attached incorporates the change suggested by Ernest. Ernest appears to have Excel 2010 and the Code performs as expected in 2010.

    Replace the old File with this File. Run the Code...let us know...
    Attached Files Attached Files

  18. #18
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Inserting Rows with Specific Data in Multiple Designated Locations

    thanks John

  19. #19
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Inserting Rows with Specific Data in Multiple Designated Locations

    @Ernest

    You're welcome...don't suppose you have access to Excel 2013???

  20. #20
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Inserting Rows with Specific Data in Multiple Designated Locations

    nope...not really sure I want too....I figured Variant will cast the data type to whatever it needs....AND you can look in the locals window and see what the system is setting the data type too....yes, my English syntax sucks....

  21. #21
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Inserting Rows with Specific Data in Multiple Designated Locations

    @Ernest

    I had previously tested Variant in 2007 and 2010 and, of course, it worked. We'll see if 2013 likes it...hopefully.

    Thanks for the input.

  22. #22
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Inserting Rows with Specific Data in Multiple Designated Locations

    Original code works in xl2013.

    @exceldummy, can you check if you have any missing references.
    With the code workbook open,
    ALT+F11 to go to VBE
    Tools > References.

    Any missing references will appear near the top of the list.
    Cheers
    Andy
    www.andypope.info

  23. #23
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Inserting Rows with Specific Data in Multiple Designated Locations

    You must select only one cell and not whole row - this will cause Type Mismatch error.
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  24. #24
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Inserting Rows with Specific Data in Multiple Designated Locations

    @Izandol

    I believe you may have discovered the issue...hope the OP hasn't given up.

+ 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: 07-05-2014, 04:07 PM
  2. insert multiple blank rows at designated cells
    By tessawanders in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-13-2014, 06:37 AM
  3. [SOLVED] Macro for inserting specific rows with data when there is a change in the column
    By KILOJulz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-08-2013, 04:19 AM
  4. Set autofit property for designated rows on multiple sheets
    By mandora in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-08-2013, 09:37 PM
  5. Inserting multiple rows in excel with data in consecutive rows
    By technotronic in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-20-2005, 11:05 AM

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