putting formula in columns by vba

hdgfss

New Member
Joined
Aug 29, 2019
Messages
41
Hi Experts,
I am looking for a macro that will put the formula in columns & will paste the formula result in values or Alphabets
I have uploaded the sample file file plz have a look & plz hardcode the path of the file in the macro so that i can change it as per my needs(macro will be placed in master.xlsm)

download file Link 1.xls

Thnx for the Help
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Try:
Rich (BB code):
Sub InsertFormulae()
    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual
    Dim LastRow As Long, flder As FileDialog, FileName As String, wkbSource As Workbook
    Set flder = Application.FileDialog(msoFileDialogFilePicker)
    flder.Title = "Please Select a Excel Macro File"
    FileChosen = flder.Show
    FileName = flder.SelectedItems(1)
    Set wkbSource = Workbooks.Open(FileName)
    With wkbSource.Sheets("1-Sheet1")
        LastRow = .Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
        .Range("N2:N" & LastRow).Formula = "=AND(D2=E2)"
        .Range("O2:O" & LastRow).Formula = "=AND(D2=F2)"
        .Range("P2:P" & LastRow).Formula = "=IF(OR(INT(D2)=INT(E2), INT(D2)=INT(F2)), TRUE, FALSE)"
        .Range("N2:P" & LastRow).Value = Range("N2:P" & LastRow).Value
    End With
    Application.Calculation = xlCalculationAutomatic
    Application.ScreenUpdating = True
End Sub
Change the sheet name (in red) to suit your needs.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,820
Members
449,049
Latest member
cybersurfer5000

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