VBA Range Calculate - Explained with Examples

We calculate the particular range using VBA. Calculate method in Excel help us to calculate all opened workbooks, specific workbooks, specific worksheets, Ranges, columns or rows. This method will be useful when your Excel Calculation method is set to manual mode. or if you have many formulas in the workbook and want to refresh or recalculate a particular range you can use Range.Calculate method.

PREMIUM TEMPLATES LIMITED TIME OFFER

ON SALE80% OFF

50+ Project Management Templates Pack
Excel PowerPoint Word

Advanced Project Plan & Portfolio Template
Excel Template

Business Presentations Templates Pack
PowerPoint Slides

20+ Excel Project Management Pack
Excel Templates

20+ PowerPoint Project Management Pack
PowerPoint Templates

10+ MS Word Project Management Pack
Word Templates


VBA Caluclate Method Excel Range Object

VBA Range Calculate – Syntax

You can use the calculate method of the range to calculate any range.

Range(“YourRange”).Calculate

VBA Range Calculate – Examples

Here is the simple example to calculate a specific Range. This example will calculate Range “A2:D10” using VBA.

Sub VBA_Calculate_Range()
Range("A2:D10").Calculate
End Sub

VBA Range Calculate – Instructions

Please follow the below step by step instructions to execute the above mentioned VBA macros or codes:

  1. Open an Excel Workbook from your start menu or type Excel in your run command
  2. Enter some formula at B2 as “=D2” and enter some value at D2. Now you can see the D2 value at B2.
  3. Set the caluclation mode to manual to test this macro
  4. Change the value at D2, now you can see that B2 value is not change even you have made changes at D2
  5. Press Alt+F11 to Open VBA Editor or you can goto Developer Table from Excel Ribbon and click on the Visual Basic Command to launch the VBA Editor
  6. Insert a Module from Insert Menu of VBA
  7. Copy the above code (for Calculating a Range using VBA) and Paste in the code window(VBA Editor)
  8. Save the file as Macro Enabled Workbook (i.e; .xlsm file format)
  9. Press ‘F5′ to run it or Keep Pressing ‘F8′ to debug the code line by line.

Now you can observe that the value at B2 is changed as per D2.

Calculate the Columns using VBA

Here is the simple example to calculate a specific Columns. This example will calculate the columns “A to D” using VBA.

Sub VBA_Calculate_Columns()
Columns("A:D").Calculate
'Or Range("A:D").Calculate
End Sub

Calculate the Rows using VBA

Here is the simple example to calculate a specific rows using VBA. This example will calculate the Rows”1 to 20″ using VBA.

Sub VBA_Calculate_Rows()
Rows("1:20").Calculate
End Sub
LIMITED TIME OFFER

Leave A Comment


Related pages


how to delete rows in excelvariable vbahow to delete doubles in excellistbox multiselect vbaworkbook objectcopy sheet excel vbaexcel select empty rowsloop vbaexcel vba create rangeminute meetings templatevba excel open text filehow to add option button in excelinterview questions on testing for freshers with answersrow height excelms excel templatesadjust column width excelexcel 2010 nested if statementsexcel hlookup exampleexcel vba msgbox optionsmatch formula in excel 2007vba examples in excelhow to extend columns in excelpowerpivot tutorial step by stephow to protect cells in a worksheethow to create a stacked bar chart in excel 2007excel create vbahow to add data validation in excelcontains vbaexcel isrefexcel insert columnsvba variant arrayopening xlsx files in excel 2003convert excel columns to rowsresource planning spreadsheet templateexcel macro conditional statementshortcut key to insert row in excel 2010excel protect with passwordexcel vba clear rangechange vbacba excelrun vba in excelunprotect excel workbook 2010 with passwordvba programming in excel examplesinsert chart title excelonline unprotect excel sheetiserror vlookup excelmacros in excel 2003excel 2010 vba editordashboard formats in excelexcel formula from another sheetexcel macro hyperlinkvba sub procedureexcel as database in vbafso filecopyvba uppercopy worksheet vbatechnical interview questions for freshers with answers pdfranges in vbaexcel metrics dashboardvba excel formulasvba excel moduleexcel formulas leftexcel vba columnsexcel eliminate duplicatessas sql interview questionsexcel macro not workingvba step by step runresource planning spreadsheet templatevb msgbox syntaxcreate pivot table in excel 2007vba application calculationunprotect excel 2010 workbookinterview questions and answers in c programming language pdfshortcut key to insert a row in excelrange excel vbavlookup and hlookup in excelexcel password remover macrosales dashboard templateexcel macro insert multiple rows