+ Reply to Thread
Results 1 to 6 of 6

Apply formula to a certain column ( attempt made )

  1. #1
    Registered User
    Join Date
    06-11-2012
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    62

    Apply formula to a certain column ( attempt made )

    Hi ALL

    So i am slowly learning to write macros.

    I want column AJ to be automatically filled using the formula that appears in my code

    Unfortunately, my code does not run

    Please Login or Register  to view this content.
    Anyone know what the issue is.

    The formula works when i just put it in myself into the first cell.

  2. #2
    Registered User
    Join Date
    06-11-2012
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Apply formula to a certain column ( attempt made )

    DELETED this particular post myself because it s against rules

  3. #3
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Apply formula to a certain column ( attempt made )

    You haven't put a value to LR. As it is, the default value for LR is 0 so therefore the Range("AJ2:AJ" & Lr) will be equivalent to AJ2:AJ0 which cannot be done.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  4. #4
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Apply formula to a certain column ( attempt made )

    Quote Originally Posted by Tmc2159 View Post
    If possible i would like this formula to be applied to the first empty column too but not sure how to do that
    First empty column at which row? Or, do you mean the first empty cell at an unknown row?

  5. #5
    Registered User
    Join Date
    06-11-2012
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Apply formula to a certain column ( attempt made )

    I have a bunch of columns with data.

    I want this formuila to be applied when I no longer have data ( the first blank column ).

    The formula:

    =I2*10000*(((((0.074*((S2+T2)/S2)^3)-(0.6406*((S2+T2)/S2)^2)+(2.6145*((S2+T2)/S2))-1.8879)*3600*2)*SQRT(298.15/(R2+273.15))*1.2943)+(((-87.297*(((C2*1.0593)-14.434)/3800)^3)+(309.6*(((C2*1.0593)-14.434)/3800)^2)-(311.63*(((C2*1.0593)-14.434)/3800))+303.7)*((C2*1.0593)-14.434)/1000000))*0.001517/((C2*1.0593)-14.434)

    would of course evolve so that I2 changes into I3 and so on for the other cells called

    I don't want it to put anything in the first row, that will be my header row.

  6. #6
    Registered User
    Join Date
    06-11-2012
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Apply formula to a certain column ( attempt made )

    Actually I just notice its always column AJ.

    So i want that formula to be applied to column AJ.

+ 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