+ Reply to Thread
Results 1 to 3 of 3

Need Macro to Input a Formula

Hybrid View

donnydorko Need Macro to Input a Formula 03-26-2009, 07:03 PM
rylo Re: Need Macro to Input a... 03-26-2009, 07:25 PM
donnydorko Re: Need Macro to Input a... 03-26-2009, 08:53 PM
  1. #1
    Forum Contributor
    Join Date
    01-25-2009
    Location
    Louisiana
    MS-Off Ver
    Excel 2007
    Posts
    177

    Need Macro to Input a Formula

    In the included file i have what i start off with and what it ends up with,

    basically i need a macro to insert the formula i have in Column M row 3, and insert it all the way down to the last letter that is contained in column k.

    So in this example The Last Letter in Column K is AQ, ( i dont physically mean last i mean last in alphabetical order in excel , such as ( W X Y Z, AB, AC , AD ) AD would be last.


    So since AQ is last it would insert the formula 43 times, which is AQ.

    THe AFter tab should clear any confusion up because this is how it looks finished.

    I use various sheets like this so the last letter changes, so having this macro be dynamic and not attached to a sheet name would be ideal.
    Thanks ,
    Attached Files Attached Files
    Last edited by donnydorko; 03-26-2009 at 08:53 PM.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Need Macro to Input a Formula

    Hi

    Try this

    Sub aaa()
      holder = 1
      For Each ce In Range("K3:K" & Cells(Rows.Count, "K").End(xlUp).Row)
        If ce <> "" Then
          If Range(ce.Value & 1).Column > Cells(1, holder).Column Then holder = Range(ce.Value & 1).Column
        End If
      Next ce
      Range("M3").Resize(holder, 1).Formula = "=$G$1&$I$1 & SUBSTITUTE(ADDRESS(1, ROW() - 2, 4), ""1"", """")"
    End Sub
    rylo

  3. #3
    Forum Contributor
    Join Date
    01-25-2009
    Location
    Louisiana
    MS-Off Ver
    Excel 2007
    Posts
    177

    Re: Need Macro to Input a Formula

    works perfectly, thanks

+ 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