+ Reply to Thread
Results 1 to 8 of 8

Copy Formula to last Used Row

Hybrid View

  1. #1
    Registered User
    Join Date
    06-20-2013
    Location
    Chicago, IL
    MS-Off Ver
    Excel 365 ProPlus
    Posts
    15

    Copy Formula to last Used Row

    Hello,

    I would like to create a Macro to auto fill a formula starting in cell A2 and fill down in column A till the last used row of column B. I am still trying to get the hang of VBA...

    This is the formula:
    = "=RC[5]&"".jpg"""
    -E.D.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    01-17-2013
    Location
    Belgium
    MS-Off Ver
    Excel 2010
    Posts
    211

    Re: Copy Formula to last Used Row

    place the below in a module and run it , let us know if it is the result you wish.
    Sub Hulpeloos()
    For B = 2 To 65000
    Dim Bvalue As String
    Bvalue = Sheets("report").Range("B" & B).Value
    If Bvalue <> "" Then
    Sheets("report").Range("A" & B).FormulaR1C1 = "=CONCATENATE(R[0]C[5],"".jpg"")"
    Else
    Exit Sub
    End If
    Next B
    End Sub
    If solved remember to mark Thread as solved , to mark your thread as Solved select Thread Tools and click Mark thread as Solved.

    I can't read the mind of my wife so then I get picture but no sound .... and then I mostly get the idea, same goes here picture your outcome and I get the idea.

  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: Copy Formula to last Used Row

    Another:

    Sub edebraal()
    Dim x As Long
    x = Range("B" & Rows.count).End(3)(2).Row - 1
    For Each cell In Range("A2:A" & x)
        cell.Value = "=" & cell.Offset(, 5).Value & ".jpg"
    Next cell
    End Sub

  4. #4
    Registered User
    Join Date
    06-20-2013
    Location
    Chicago, IL
    MS-Off Ver
    Excel 365 ProPlus
    Posts
    15

    Re: Copy Formula to last Used Row

    Hulpeloos - This worked great. Is there a way that I can have the value of the formula in the cell instead of just showing it? I thought to just copy paste with the value only option but if it would be added to this it would be great.

    John - Thanks for your idea as well it also worked but I get a run-time error '1004' and the cells say #NAME?. The value of the cells is right but there is and "=" sign in front of each of them. Is there a way to remove this from yours that will eliminate this error?

    Thanks again for all your help!
    Last edited by edebraal; 09-30-2013 at 02:41 PM.

  5. #5
    Forum Contributor
    Join Date
    01-17-2013
    Location
    Belgium
    MS-Off Ver
    Excel 2010
    Posts
    211

    Re: Copy Formula to last Used Row

    you want it to show
    RJA01WMC1002.jpg or =CONCATENATE(F2;".jpg")
    or even something else , i'm a bit confused

  6. #6
    Registered User
    Join Date
    06-20-2013
    Location
    Chicago, IL
    MS-Off Ver
    Excel 365 ProPlus
    Posts
    15

    Re: Copy Formula to last Used Row

    I was able to take John's and just make the adjustment to remove the
     "="
    from the report and it worked. Thanks to both of you for your help!
    Last edited by edebraal; 10-08-2013 at 06:54 PM. Reason: Figured out the answer!

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

    Re: Copy Formula to last Used Row

    You're welcome. Glad to help out.

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Copy Formula to last Used Row

    Try the attached.
    Attached Files Attached Files

+ 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: 3
    Last Post: 01-30-2013, 04:32 PM
  2. make faster copy paste or formula to assist in copy
    By gill389 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-15-2010, 02:07 AM
  3. Copy Multi Formula and then freeze cell refs before second copy
    By Trig79 in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 11-23-2009, 07:53 AM
  4. Copy Formula:copy the exact same formula in one column
    By Leprechaun in forum Excel General
    Replies: 1
    Last Post: 12-11-2006, 07:46 PM
  5. Replies: 10
    Last Post: 03-02-2006, 06:50 PM

Tags for this Thread

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