+ Reply to Thread
Results 1 to 4 of 4

Code for dragging down a formula across the row below the last line of data

  1. #1
    Registered User
    Join Date
    10-13-2013
    Location
    Houston, TX
    MS-Off Ver
    Excel 2010
    Posts
    28

    Code for dragging down a formula across the row below the last line of data

    Hello All,

    I just started working and I have been given an assignment to create a Macros tool in which the user will be provided with a user form to input data. The data (which are UTM coordinates) will then be added to a list on one tab in an excel worksheet. On another tab, there is a matrix that has the distance between each site. This distance is calculated using a formula which has already been created. Each time new site data is added, a row and column will be added to the matrix database. I am having trouble writing the correct code which will drag down the formula across the last row of data to find the distances between each site. Here's what I have so far which actually goes about it a slightly different way. A loop is formed to count how many rows of data there are, then at the last row, the formula from above is dragged down. Any help willbe VERY much appreciated.



    Please Login or Register  to view this content.
    Moderator Note:

    Pls use code tags around your code next time as per forum rules.
    Last edited by Fotis1991; 10-14-2013 at 09:27 AM.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Code for dragging down a formula across the row below the last line of data

    This will fill column B with the formula from B2 to the last used row from column A. The formula relative references will change for each row.

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    10-13-2013
    Location
    Houston, TX
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Code for dragging down a formula across the row below the last line of data

    AlphaFrog,
    Thank you so much!! The code is perect and I cannot thank you enough.

  4. #4
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Code for dragging down a formula across the row below the last line of data

    Welcome to the forum.

    As you see i put code tags in your post as per forum rules.

    Also:

    Based on your last post in this thread, its apparent that you are satisfied with the solution(s) you've received and have solved your question, but you haven't marked your thread as "SOLVED",as per our Forum Rule #9. I will do it for you this time.

    In future, to mark your thread as Solved, you can do the following -
    Select Thread Tools-> Mark thread as Solved.

    Incase your issue is not solved, you can undo it as follows -
    Select Thread Tools-> Mark thread as Unsolved.

    Also, since you are relatively new to the forum, i would like to inform you that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post which helped you. This adds to the reputation of the person who has taken the time to help you.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

+ 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. [SOLVED] Summing in Line Graph or Changing What Dragging a Formula does?
    By Caulerpa in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 12-04-2012, 12:23 PM
  2. [SOLVED] Save Data code not saving to the next line, keeps overwriting to same line.
    By Justin25150 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-01-2012, 06:40 AM
  3. Skip every other line while dragging formula
    By dlswa in forum Excel General
    Replies: 2
    Last Post: 03-05-2012, 09:31 PM
  4. Dragging Formula Code
    By RynNap1 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-11-2009, 11:45 AM
  5. Excel 2007 : dragging a line in a chart
    By relayer in forum Excel General
    Replies: 3
    Last Post: 11-25-2009, 05:33 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