+ Reply to Thread
Results 1 to 5 of 5

Need help autofilling columns in a macro!

  1. #1
    Registered User
    Join Date
    06-24-2015
    Location
    Cleveland, Ohio
    MS-Off Ver
    Excel 2010
    Posts
    5

    Question Need help autofilling columns in a macro!

    I'm a little new to macros...but I've created a macro that sorts a bunch of data. I have it set to copy and paste data from one sheet onto a new sheet. The first two data sets I was given to sort went down 20985 rows. So when I created the macro it would set the range of copying and pasting to EX: (A2:A20985) --------And I thought I was going to be given all data that went down 20985 rows. I now realize it's all random and my next data set goes down 80,000 rows. How do I change the coding to not pick a specific range of numbers, but have it detect the number of rows it goes down and use that number. So EX: (A2-AXXXXXXX) I hope this makes sense... Any help would be appreciated =) Thank you!
    Last edited by radius1080; 06-30-2015 at 10:13 AM.

  2. #2
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Macro help

    Hello
    I usually use a Variable (As Long), for example:

    Please Login or Register  to view this content.
    This will find the row number of the last used row in column "A". You can then use this to define the range of your copy marcro.

    Hope this helps.
    DBY

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

    Re: Macro help

    Maybe:

    Please Login or Register  to view this content.

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Macro help

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution.

    Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.

    To change a Title go to your first post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

  5. #5
    Registered User
    Join Date
    06-24-2015
    Location
    Cleveland, Ohio
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Need help autofilling columns in a macro!

    On my original macro I performed an auto-fill in a single column...So I filled in data...let's just say J2 and took it and drug down to J6956. In VBA it goes range (J2-J6956). In what way would you manipulate this to have a changing range say (J2-JXXXXX)...the "XXXXX" being the copy and pasted values down in the column next to it. So example: in one document the column next to it went down (I2-I 13000) <------[the copy and pasted values]....and (J2-J6956) needed to change to (J2-13000)....
    my problem is that the autofills need to be dynamic instead to one set value. Do you have any idea how to help me in this situation?

+ 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. Using a macro on workbook1 to create a button in wb2 and assigning macro "wb2!macro"
    By penfold1992 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-13-2014, 11:39 AM
  2. [SOLVED] Macro to show Which macro didnt work in a nested macro
    By akhileshgs in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-10-2013, 03:21 AM
  3. Perform macro "on open" specific file- store macro in Personal Macro Workbook?
    By thompssc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-17-2012, 12:38 PM
  4. lookup macro, solver macro, realtime macro
    By xelhelp in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-02-2011, 06:14 PM
  5. Cannot find macro error when running a macro from a macro in a diffrent workbook.
    By Acrobatic82 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-05-2010, 09:22 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