Results 1 to 4 of 4

Vba for multiplication

Threaded View

  1. #1
    Forum Contributor
    Join Date
    02-13-2014
    Location
    India
    MS-Off Ver
    Excel 2013
    Posts
    140

    Vba for multiplication

    Hi I have below code.

    Sub sixsheet()
    Dim rng, r  As Range
    With Worksheets("06sheet")
        Const n As Long = 5 ' Last number to be changed if nuber of top records to be changed
        Set r = .Cells.Find("*", .Cells(Rows.Count, Columns.Count))
        If r Is Nothing Then MsgBox "No data": Exit Sub
        Set rng = .Range(r, .Cells(Rows.Count, r.Column).End(xlUp))
        With rng.Resize(n + 1)
            Union(.Columns(1), .Columns(3)).Copy r.End(xlToRight)(, 2)
        End With
        With r.End(xlToRight)(n + 2).Resize(, 3) 'Change the last number "3" to change the sum calculation field.
            .FormulaR1C1 = "=sum(r" & r.Row + 1 & "c:r[-1]c)"
            .Font.Bold = True
        End With
            
        With r.End(xlToRight)(, 2).Resize(, 2)
            .Cells(, 0).Copy .Cells
            .Value = [{"SOW"}]
            .Cells(2, 1).Resize(n).FormulaR1C1 = "=rc[-1]/r" & r.Row + n + 1 & "c[-1]"
            .Cells(2, 1).Resize(n + 1).NumberFormat = "#0.00%"
        End With
    
        With r.End(xlToRight)(, 1).Resize(, 1)
            .Cells(, 0).Copy .Cells
            .Value = [{"No of claims (%)"}]
            .Cells(2, 1).Resize(n).FormulaR1C1 = "=rc[-5]/r" & r.Row + n + 1 & "c[-5]"
            .Cells(2, 1).Resize(n + 1).NumberFormat = "#0.00%"
        End With    
        .Columns("A:I").AutoFit
    End With
    End Sub
    In above code in last created Column H, I wanted to change the cell number of total value

    At present the valuse of C divided by cell C12. But I wanted to Change the code where Cell c12 to be the last of the Column C.

    For formula example refere sheet "Result" Column H.
    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. [SOLVED] Value Multiplication
    By jani.pk in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-08-2019, 03:48 PM
  2. [SOLVED] Sum of multiplication and add-up
    By Seifptv in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-19-2018, 07:42 PM
  3. IF/or with multiplication
    By BoudeyCall in forum Excel General
    Replies: 8
    Last Post: 02-03-2017, 03:01 PM
  4. Multiplication
    By kmarie630 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-25-2009, 03:59 PM
  5. Help with multiplication
    By GatorRaucous in forum Excel General
    Replies: 3
    Last Post: 02-07-2009, 04:44 PM
  6. multiplication
    By cevahir in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-24-2007, 06:37 PM
  7. [SOLVED] multiplication
    By gem in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-14-2006, 03:55 AM

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