insert formula by code

  1. C

    Inserting formula with a macro

    Hi there, I have tried searching other threads but they were all too old and didn't really answer my problem... I have a command button that when i click it needs to insert a formula into a target cell, i have done this with another button in the same sheet and it works fine but VBA has a...
  2. H

    Insert Formula in a cell

    Dim wb As Workbook Dim ws As Worksheet Dim TotalTrans As Integer Dim FoundRow As Range Dim MyFolder, MyFile, MyFileName, MySheetName, ReportDate As String Dim FileType As String Dim MisFileName() As String, PaymentFileType() As String Dim MisTrans() As Integer Dim i, j, k, m As Integer i = 2 j =...
  3. J

    Macro to insert IF "A" or "B" Then Do "C" - Not Working (Run-time error 13: Type Mismatch)

    Any thoughts why my If .value = "A" or "B" then statement isn't working? Sub Remove_CorrNeg_Transaction_Entries() Dim Dest_Firstrow As Long Dim Dest_Lastrow As Long Dim lRow As Long Dim CalcMode As Long Dim ViewMode As Long With Application CalcMode =...
  4. C

    Macro to add a formula to a cell and fill down the column

    I'm trying to create a macro that will insert a formula into Column D and fill all the way down the column. The formula is a series of IF statements referencing the corresponding cell in Column C. The formula I would like to insert is the following: =IF(C2="G1","Generic...
  5. T

    Using variable cell reference in vba to insert formula

    Hi, I think I'm nearly there with this, but just need a bit of help tweaking it to make it work. I'm wanting to use vba to add an indirect formula in a range of cells with a lastrow variable. So far I have this, but I can't get the last row variable to work. When I set the Range as (D20:F30)...
  6. kyrgan

    Creating % of Grand Total for Selection.Subtotal formula

    Hello all, I am using the following to create subtotals from a selection Range("B3:N1000").Select Selection.Subtotal GroupBy:=2, Function:=xlSum, _ TotalList:=Array(5, 6, 7) ActiveSheet.Outline.ShowLevels RowLevels:=2 I need to add a column with the sales percentage: the Net...
  7. T

    How can I shortcut all this code into a loop of some kind please.

    Hi everybody! I have columns of data that are generated by formulae inserted by the following code. Private Sub XtendData() Dim w As Integer ‘Insert formulae in Col 22 For w = 12 To 200 Step 2 Cells(w, 22).FormulaR1C1 = "=IF(OR(RC[-14]="""", RC[-8] = """"), """", IF(RC[-14]...

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top