+ Reply to Thread
Results 1 to 5 of 5

Assistance with Copy Down Macro

  1. #1
    Registered User
    Join Date
    04-22-2014
    Location
    Wiscasset Maine
    MS-Off Ver
    Excel 2019
    Posts
    26

    Assistance with Copy Down Macro

    I always have problems with macros that I want to copy a formula down, but don't want to limit the copy down to specific row numbers - because each spreadsheet might be a different size.

    On the attached simplified document, which starts as a download file, column A is all in Text, which I need converted to a number. So I start by copying down and then 'convert to number' and then I do a '=right(A1,4) formula in cell B2 and copy that down. When I run this macro in other similar workbooks, First, Column A isn't converting to a number and Column B is inputting the formula but only as far as the macro instructs it to and not down the entire column. Can someone please help?
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Assistance with Copy Down Macro

    This will do it. You can remove the line in red if you really want the formulas left behind, they aren't really needed after they've done their work:

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    04-22-2014
    Location
    Wiscasset Maine
    MS-Off Ver
    Excel 2019
    Posts
    26

    Re: Assistance with Copy Down Macro

    Thank you so much. I haven't inserted it into my macro yet, but I have a question - so the meat of the macro you just created is actually being inserted in the middle of a much larger macro. I can take out the beginning and ending 'sub' ... but what about the instruction Dim LR as Long? I don't recognize that code and not sure where it goes if I remove the beginning Sub title.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Assistance with Copy Down Macro

    You can keep all these lines of code together as you see them now, if you wish. DIMS are declaration of variables that area used throughout the macro, they are typically found all at the top of the macro for easy reference, but they can be anywhere as long as they come BEFORE you try to use them.

  5. #5
    Registered User
    Join Date
    04-22-2014
    Location
    Wiscasset Maine
    MS-Off Ver
    Excel 2019
    Posts
    26

    Re: Assistance with Copy Down Macro

    Thank you. That worked well and I was able to modify your code to work in other pertinent applications where I had that similar problem. Thanks.

+ 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. Copy data from other files and paste in current file ----really need assistance
    By aetedford in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-02-2013, 05:37 PM
  2. Assistance wth a MACRO
    By nick_w in forum Excel General
    Replies: 0
    Last Post: 02-29-2012, 11:42 AM
  3. [SOLVED] Macro assistance please
    By DannyStyle22 in forum Word Programming / VBA / Macros
    Replies: 1
    Last Post: 01-20-2011, 12:47 PM
  4. Macro assistance
    By johnsid in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-10-2007, 09:29 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