+ Reply to Thread
Results 1 to 5 of 5

VB Code to apply a formula to entire column

  1. #1
    Forum Contributor
    Join Date
    06-17-2014
    Location
    london
    MS-Off Ver
    365
    Posts
    398

    VB Code to apply a formula to entire column

    Hi All

    I try to explain what I need to do.(for some reason I can not attached a worksheet=, and I will appreciate if the code is given to me in the body of the email using #Code)

    Col A Col B Col C
    111 2222 False
    222 2222 False
    .
    .
    .
    .
    .
    ..
    to end row

    I need to write a VB code (and I know I can just use a formula to do this but I need this for another functions and other manipulations and hence need VB code)

    I have two columns and want to see whether the two columns match, i.e. I need to apply the following formula in col c2 if(a2=b2,"Yes","No")
    and I need to repeat the same formula for all the rows until I reach the end of the file. My actual sheet has 100 of thousands of rows and has other functions in there, but If I can gte this code then I can perform other operations which I need.

    Any help is appreciate it

  2. #2
    Forum Contributor
    Join Date
    06-02-2015
    Location
    delhi
    MS-Off Ver
    2010
    Posts
    104

    Re: VB Code to apply a formula to entire column

    Sub T()

    Range("C2").FormulaR1C1 = "=if(RC[-1]=RC[-2],""Yes"",""NO"")"
    Range("C2:c" & Cells(Rows.Count, 1).End(xlUp).Row).FillDown
    End Sub

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: VB Code to apply a formula to entire column

    Or just ...

    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Contributor
    Join Date
    06-17-2014
    Location
    london
    MS-Off Ver
    365
    Posts
    398

    Re: VB Code to apply a formula to entire column

    Thank you so much, this worked perfectly

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: VB Code to apply a formula to entire column

    You're welcome. Thanks for the rep.

+ 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. [SOLVED] Apply formula to entire column that references rows above?
    By bvercher in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-03-2015, 06:15 PM
  2. [SOLVED] How to apply formula to entire column
    By i.r.smith in forum Excel General
    Replies: 3
    Last Post: 09-01-2014, 05:44 PM
  3. Replies: 3
    Last Post: 07-28-2012, 09:58 PM
  4. Apply formula to entire column macro
    By aznprod517 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-06-2009, 10:41 AM
  5. Apply MONTH formula to entire column
    By aspen_gal in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-30-2009, 01:42 PM
  6. Formula that will apply to entire column???
    By borbafett in forum Excel General
    Replies: 2
    Last Post: 04-29-2008, 03:40 PM
  7. [SOLVED] I want to apply a formula to an entire column.
    By kitcox in forum Excel General
    Replies: 3
    Last Post: 11-27-2005, 09:50 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