+ Reply to Thread
Results 1 to 8 of 8

Copy a formula down in blank cells

  1. #1
    Registered User
    Join Date
    06-12-2012
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    8

    Copy a formula down in blank cells

    Hi,

    I'm pretty new to VBA and I need to create a macro. I have managed part by using the record macro function (though I'm sure this can be simplified). However, I am coming unstuck as I do not know how to copy the fomulae in column T down to the last cell in column T where the colum one to the left (S) contains data. The current macro just copies down to a pre specied cell. I alos then need to sum the column of data.

    Below is how my macro currently looks. Any help you can give me with the Macro would be very much appreciated.

    Please Login or Register  to view this content.
    Thanks all for your help,

    Kp
    Last edited by Kevin P; 06-13-2012 at 06:43 AM. Reason: Code tags

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Help needed to copy a furmula down in blank cells.

    One major cleanup you can do is remove all the ActiveWindow.ScrollRow and smallscroll lines.

    Why dont you attach the file that you are using?

    Why are you using text to columns at the beginning of your code?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    06-12-2012
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Help needed to copy a furmula down in blank cells.

    Hi Arlette,

    I'm pasting in a file from note pad to excel, I then have to split by pipe delimited. Which is the reason for the text to coloumns at the start. I'm then adding a column after S. The purpose of this column is a to add a new value based on the debit or credit in coloumn S. I then need to copy the formulae down to the last row of data, which will vary each day. Then sum it at the bottom. It's a quick check I need to conduct to make sure the file always come to zero.

    I have attached the file I'm using, having taken out any confidential information.


    Kevin,
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    883

    Re: Copy a formula down in blank cells

    Kevin, try this.
    BTW, you don't have to copy/paste from notepad, turn on the recorder and click open file (or import) and select the file, it will say its not a recognised filetype and then give you the text to columns dialog, set your arrays and then replace the code in red with the new code. Then you can run the code without opening the text doc.
    Please Login or Register  to view this content.
    If my solution worked (or not) please let me know. If your question is answered then please remember to mark it solved

    Computers are like air conditioners. They work fine until you start opening windows. ~Author Unknown

  5. #5
    Registered User
    Join Date
    06-12-2012
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Copy a formula down in blank cells

    WasWodge,

    Thanks you so much. Works perfectly and exactly what I need.

    Great forum, did not expect a resoloution so quickly!!!

    kev,

  6. #6
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    883

    Re: Copy a formula down in blank cells

    No problem. If you consider the question answered remember to mark the thread as "solved".


    To mark your thread solved do the following:
    - Go to the first post
    - Click edit
    - Click Advance
    - Just below the word "Title:" you will see a dropdown with the word No prefix.
    - Change to Solve
    - Click Save

  7. #7
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Copy a formula down in blank cells

    Alternatively,

    Marking threads "Solved" just got better. Select Thread Tools (on top of your 1st post) -> Mark this thread as Solved. To undo the action, just go back to Thread Tools -> Mark this thread as Unsolved.

  8. #8
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    883

    Re: Copy a formula down in blank cells

    Thanks for that Arlu, forgot about the new method of marking posts solved.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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