+ Reply to Thread
Results 1 to 13 of 13

Autofill rows, 1 by 1 when executing a macro

  1. #1
    Registered User
    Join Date
    11-20-2018
    Location
    Mexico
    MS-Off Ver
    2016
    Posts
    6

    Question Autofill rows, 1 by 1 when executing a macro

    Hello Guys,

    I'm new in macros world, today I'm trying to make a macro to add 1 row at the bottom of my table every time I execute a macro, the new row must be add with "autofill" because I have some cells with list and dependent lists. Every time i execute my macro i need to autofill a new row from column "A" to "G" for example, at beging I'll have data in cells from "A3" to "G3", if i execute the macro a new line will be autofilled "A4" to "G4" but data in cells "D4" to "G4" must be blank so i can select new values from the lists, and if i execute the macro the range "A4" to "G4" must be autofilled to create "A5" to "G5" and the new cell must be blank.
    the code i already have only add me 1 row, but if i execute it again nothing happens, this code is:

    Please Login or Register  to view this content.
    There you have some picts to show a better example:
    Thats before executing the macro:
    asasasasasasas.PNG

    Thats after executing the macro:
    dgdsfgfdg.PNG

    Hope you can help me, thanks!

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: Autofill rows, 1 by 1 when executing a macro

    Try code like

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    11-20-2018
    Location
    Mexico
    MS-Off Ver
    2016
    Posts
    6

    Re: Autofill rows, 1 by 1 when executing a macro

    Hello Bernie, the code worked partially, the thing is, i need to use autofill because some cell have lists taken from other table, if i copy&paste this list won't show off

    Thank you!

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: Autofill rows, 1 by 1 when executing a macro

    Well, the macro can fill your table from the other table - you just need to explain the logic and show the layout of the other table.

  5. #5
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,285

    Re: Autofill rows, 1 by 1 when executing a macro

    Perhab like this if use autofill
    Please Login or Register  to view this content.
    "ThankyouFor Attention * And Your Help!!"

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Autofill rows, 1 by 1 when executing a macro

    Hi daboho,

    Purely an observation. Since this OP is new to macros, might it be helpful to declare a variable with the words versus the declaration character?

    This is...
    Please Login or Register  to view this content.
    Equal to...
    Please Login or Register  to view this content.
    Again, only an observation and I put the above for the OP as I know you know this already.
    HTH
    Regards, Jeff

  7. #7
    Registered User
    Join Date
    11-20-2018
    Location
    Mexico
    MS-Off Ver
    2016
    Posts
    6

    Re: Autofill rows, 1 by 1 when executing a macro

    I can't upload the document, so i'll try to explain it, the table i want to add rows is in sheet "Datos", you can se a green button with "+" sign that execute the macro.
    Data in column "D" & "E" could be selected form a drop-down list from tables in sheet "Listas Desplegables", this list are made with "Data validation" and are direct values.
    Data in column "F" could be selected from a drop-dwon list from tables in sheet "Listas Desplegables", this list are made using "Data Validation" and are indirect values depending on values of column "E"
    Data and fx in columns "A" & "B" are for other functions i'll add later.

    Thank you again!

  8. #8
    Registered User
    Join Date
    11-20-2018
    Location
    Mexico
    MS-Off Ver
    2016
    Posts
    6

    Re: Autofill rows, 1 by 1 when executing a macro

    Here is my document, you can see it in the link, i think im not explaining properly, just paste everything together

    https
    :
    //
    we.
    tl/t-zhuOq2SeKa

  9. #9
    Registered User
    Join Date
    11-20-2018
    Location
    Mexico
    MS-Off Ver
    2016
    Posts
    6

    Re: Autofill rows, 1 by 1 when executing a macro

    Hello daboho, i tried this code, but when i execute it an error 1004 apears

  10. #10
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: Autofill rows, 1 by 1 when executing a macro

    To get the data validation onto those cells, try:

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    11-20-2018
    Location
    Mexico
    MS-Off Ver
    2016
    Posts
    6

    Re: Autofill rows, 1 by 1 when executing a macro

    Quote Originally Posted by Bernie Deitrick View Post
    To get the data validation onto those cells, try:

    Please Login or Register  to view this content.
    WOW! this worked perfecly! tank you so much!

  12. #12
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,285

    Re: Autofill rows, 1 by 1 when executing a macro

    Ok thank.jefry for suggestion

  13. #13
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: Autofill rows, 1 by 1 when executing a macro

    Quote Originally Posted by mterrazas View Post
    tank you so much!

    And nozzles to you - sorry, an old engineering joke from my days as a petrochemical engineer (we used 'tanks' instead of 'thanks', and 'nozzles' instead of 'no problems'...)

+ 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. Need help with macro to autofill new rows with formula
    By durna01 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-10-2017, 11:17 AM
  2. [SOLVED] Autofill macro populates blank rows after row removal by filtering
    By picton2000 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-17-2017, 01:04 PM
  3. [SOLVED] Macro to autofill cells and delete some rows and columns
    By k.m. in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-20-2015, 06:09 PM
  4. macro - autofill formula to end of data rows
    By ugg in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-29-2007, 04:16 AM
  5. Using Autofill in a macro with variable rows
    By svconway in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-18-2007, 06:38 PM
  6. [SOLVED] Autofill Macro for 2 rows and 100 columns
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-04-2005, 10:05 AM
  7. Autofill Macro for 2 rows and 100 columns
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-04-2005, 08: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