+ Reply to Thread
Results 1 to 13 of 13

Copying formula from one cell to another in the same column

  1. #1
    Registered User
    Join Date
    10-05-2017
    Location
    Texas
    MS-Off Ver
    Office 2016
    Posts
    18

    Copying formula from one cell to another in the same column

    I need help with creating a Macro/VBA Code that will start off by clearing any existing data that is in Cell I17 down to the end of the spreadsheet and to the right to the end of the spreadsheet. Copy the formula in Cell I1 into the corresponding Cell that matches the row of dates from Column H to the date that is in Cell I13. After the formula is pasted, copy the formula down. Then move over to the next column and repeat the process until it finds two blank columns. Note: All formulas in row one are unique to each column.

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Copying formula from one cell to another in the same column

    Hi, once you have the formula in the top wor you can use the following

    Please Login or Register  to view this content.
    Where S is the column and the rows

    for example

    in S2 I place the formula and then copy it down 41 rows
    Please Login or Register  to view this content.
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Registered User
    Join Date
    10-05-2017
    Location
    Texas
    MS-Off Ver
    Office 2016
    Posts
    18

    Re: Copying formula from one cell to another in the same column

    Hi Keebellah, I appreciate the quick response. Not sure I understand what I am to do. (I am a beginner with using VBA) How do I use your code? Also please note that the dates in row 13 vary from column to column.

  4. #4
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Copying formula from one cell to another in the same column

    You question gave me the impression that you had some basic knowledge; okay, I don't know what you mean with the the dates differ per column.
    My answer is only the formula and the code to copy it doen.
    I suggest you attach the file, make sure there is no sensitive data, and place the formula you have or want in there.
    You can also give it a try too.
    Open the file and start the macro recorder, give the macro a name and then do the steps you explained.
    You place the formula i the cell you want in row 13 then select the right bottom corner and copy the formula down to the last row you want the formula in.
    Stop the macro recorder and the open the VBA editor and take a look at the macro.

  5. #5
    Registered User
    Join Date
    10-05-2017
    Location
    Texas
    MS-Off Ver
    Office 2016
    Posts
    18

    Re: Copying formula from one cell to another in the same column

    It appears I am not authorized to attach a file so you can see. The formula that is Cell I1 is =$I$8*$I$9*$I$10*$I$11*'Type Curve'!B4. The date in Cell I13 is 01/01/19 and I need to find the date (01/01/19) from the list of monthly dates in Column H starting from Cell H17, once it finds the date then copy the formula from Cell I1 into the appropriate row in Column I. The formula that is in Cell J1 is =$J$8*$J$9*$J$10*$J$11*'Type Curve'!B4. The date in Cell J13 is 09/01/18. I really appreciate your time with helping me.

  6. #6
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Copying formula from one cell to another in the same column

    Everyone can attach a file, follow the instructions
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    10-05-2017
    Location
    Texas
    MS-Off Ver
    Office 2016
    Posts
    18

    Re: Copying formula from one cell to another in the same column

    Oh! my bad. Here you go.
    Attached Files Attached Files

  8. #8
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Copying formula from one cell to another in the same column

    Okay, got the file, this is much better that the explanation which gave me no clue what it looks like.
    I think I can manage, I won't be adding much explanation to how I coded it but let's see if I can het it done for you for now.
    Hope to do it before bedtime here, its 11:35 PM now

  9. #9
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Copying formula from one cell to another in the same column

    Okay, it's bedtime here but here's the file.
    Hope it works in the 'panhandle'
    Will read the results tomorrow

    Just press the smiley (button) on the worksheet, the text 'Click the smiley ..' in the columns will be cleared automatically
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    10-05-2017
    Location
    Texas
    MS-Off Ver
    Office 2016
    Posts
    18

    Re: Copying formula from one cell to another in the same column

    OMG!!!! You ARE the BEST!!!! You have saved me hours of manually copying and pasting whenever I have to update my report. My actual report ends in Column CP, so I changed it in the code and it works like a dream. I can't thank you enough for all your help.

  11. #11
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Copying formula from one cell to another in the same column

    You're welcome
    A minor modification let's say you don't want a column to be calculated you can add a test to check if the formula is present:

    I added two lines of code
    one richt below the for each c

    Please Login or Register  to view this content.
    and one before the Next c

    Please Login or Register  to view this content.
    This way you can expand the report and leave the formula in row 1 blank to not include that row or while preparing your data

    Please Login or Register  to view this content.

  12. #12
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Copying formula from one cell to another in the same column

    And one thing I forgot, to speed up the macro
    add

    Before the clearing of the data

    Please Login or Register  to view this content.
    right after Next c

    Please Login or Register  to view this content.
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    10-05-2017
    Location
    Texas
    MS-Off Ver
    Office 2016
    Posts
    18

    Re: Copying formula from one cell to another in the same column

    Awesome! Thanks once again.

+ 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: 06-19-2012, 10:35 AM
  2. Copying a Formula into Every other Cell In a Column
    By Bob Phillips in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2005, 07:05 AM
  3. [SOLVED] Copying a Formula into Every other Cell In a Column
    By Bob Phillips in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2005, 04:05 AM
  4. [SOLVED] Copying a Formula into Every other Cell In a Column
    By carl in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  5. Copying a Formula into Every other Cell In a Column
    By carl in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  6. Copying a Formula into Every other Cell In a Column
    By carl in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  7. [SOLVED] Copying a Formula into Every other Cell In a Column
    By carl in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 PM
  8. [SOLVED] Copying a Formula into Every other Cell In a Column
    By carl in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 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