Results 1 to 8 of 8

Add formula through VBA

Threaded View

internet_imran Add formula through VBA 11-27-2019, 05:27 AM
KOKOSEK Re: Add formula through VBA 11-27-2019, 05:52 AM
internet_imran Re: Add formula through VBA 11-27-2019, 05:56 AM
mohadin Re: Add formula through VBA 11-27-2019, 06:18 AM
nigelog Re: Add formula through VBA 11-27-2019, 06:20 AM
internet_imran Re: Add formula through VBA 11-27-2019, 06:26 AM
nigelog Re: Add formula through VBA 11-27-2019, 06:29 AM
mohadin Re: Add formula through VBA 11-27-2019, 06:43 AM
  1. #1
    Forum Contributor
    Join Date
    12-24-2005
    Posts
    104

    Add formula through VBA

    Dear friends,

    Please help me how to Add formula through vba in the attached file on Column K.
    I add Joint formula of COUNTIF and SUMIF to calculate amount of Column J in the attached file.

    Thanking you

    Imran

    My code is here
    Sub formula()
     Dim Cell As Range
    Dim rng1  as string
    Dim rng2  as string
    Dim rng3  as string
    
    rng1 = "=IF("
    rng2 = "COUNTIF($A$2:A2,A2)=1,"
    rng3 = "SUMIF($A:$A,A2,$J:$J),"")""
    
        For Each Cell In Range("K2:K" & Cells(Rows.Count, "A").End(xlUp).Row)
    
                Cell.Formula = rng1 & rng2 &rng3
                
       End If
       Next Cell
    End Sub
    Attached Files Attached Files

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-10-2019, 09:34 AM
  2. Replies: 5
    Last Post: 02-16-2018, 06:50 AM
  3. Replies: 8
    Last Post: 09-22-2017, 05:41 AM
  4. Excel formula bar to display the result of the formula , not the formula?
    By max_max in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-18-2016, 07:15 PM
  5. Replies: 11
    Last Post: 06-06-2014, 03:34 PM
  6. how to hide formula in formula box, view lookup result in formula box?
    By vengatvj in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-14-2013, 04:06 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