This video shows how to enter values into cells using Excel macros and Visual Basic. This includes a sample Expense Report that is used in this demonstration. In this demonstration, we will create the macro that inputs a title as "Expense Report", Three columns i.e. "Date", "Item" & "Amount", and the summery field as "Total Expenses", as well as the formulas located at the respective cells. Now, we're going to use two keyboard shortcuts i.e. "Alt + F11" to openup the VBA window and "Alt + F8" for viewing macros. Now, first we'll start with the VBA window, go to insert menu and select module to open the module window, and add the new Values_Input() module to create the Expense Report through the macros. Now, to input the values into the cells, we use the range object i.e. Range("A1").Value, to assign the value to the cell. Then with the "Equal to" sign, we'll write with quotation "Expense Report". Then in the next line again do the same practice for "Date", "Item", "Amount" and "Total Expenses" columns, by giving the cell number and values to that cell. Then in next line, we need to give a formula for the "Total Expenses" column, i.e. "=SUM(C:C)" as we need to sum the entire "Amount" column and give value to "Total Expenses" column. Now, as our macro is ready to be used, we'll delete every thing from cell "A1" to "F3". Then, using the shortcut "Alt + F8", select the macro from the list and Run. Every thing is back as it was before. Now, in order to link/assign one cell value to another, we need to define the column range (e.g. "E4:E6") instead of a particular cell number and assign its value by formula (e.g. "=C4"). Then, run the macro again, and you'll see that the values in column "C" are assigned to its respective cell in column "E". However, if you put the dollar sign ($) in the formula reference (i.e. "=$C$4"), it will not update the cells, because it will consider it as absolute reference values. So, that's how we can enter values into the cells using macros.
 Hot
 Latest

How To: Find a PValue with Excel

How To: Generate random numbers (with decimals) in Excel

How To: Calculate Commission Based on Varying Rates in Excel

How To: Create a stem & leaf chart with Excel's REPT & COUNTIF

How To: Create an Excel inventory template with running totals

How To: Do matrix multiplication and inverse in MS Excel

How To: Save Your Word Document as PDF with One Click (Using a Macro)

How To: Align & group objects & use gridlines in MS Word 2007

How To: Create a Basic Attendance Sheet in Excel

How To: Create a passfail grade formula in Microsoft Excel

How To: Use conditional formatting for a student grading report in Microsoft Excel

How To: Clear data & cell contents in Excel using a macro

How To: Create an Excel spreadsheet to calculate your GPA

How To: Create a simple database in Excel with a list or table

How To: Calculate incentive rates by formula in MS Excel

How To: Create a multiuser login system in Microsoft Access

How To: Highlight Excel values repeated a set number of times

How To: Calculate monthly retirement income in Microsoft Excel

How To: Calculate APR, EAR & period rates in Microsoft Excel 2010

How To: Measure the spread of a data set with Excel's AVEDEV

How To: Find a PValue with Excel

How To: Generate random numbers (with decimals) in Excel

How To: Calculate Commission Based on Varying Rates in Excel

How To: Create a stem & leaf chart with Excel's REPT & COUNTIF

How To: Create an Excel inventory template with running totals

How To: Do matrix multiplication and inverse in MS Excel

How To: Save Your Word Document as PDF with One Click (Using a Macro)

How To: Align & group objects & use gridlines in MS Word 2007

How To: Create a Basic Attendance Sheet in Excel

How To: Create a passfail grade formula in Microsoft Excel

How To: Use conditional formatting for a student grading report in Microsoft Excel

How To: Clear data & cell contents in Excel using a macro

How To: Create an Excel spreadsheet to calculate your GPA

How To: Create a simple database in Excel with a list or table

How To: Calculate incentive rates by formula in MS Excel

How To: Create a multiuser login system in Microsoft Access

How To: Highlight Excel values repeated a set number of times

How To: Calculate monthly retirement income in Microsoft Excel

How To: Calculate APR, EAR & period rates in Microsoft Excel 2010

How To: Measure the spread of a data set with Excel's AVEDEV
Be the First to Comment
Share Your Thoughts