Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Inserting Worksheet Values with a Macro.
Written by Allen Wyatt (last updated December 16, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021
Inserting values into a cell is done quite often in macros. In order to insert information into a cell, you use the Value property. For instance, you could use the following to insert a number (23) into cell A1:
Cells(1, 1).Value = 23
For entering information in a cell, the Value property is applicable to any object that resolves to a range. Thus, you could use the following to place a text value ("Address") into the cell at C4:
Range("C4").Value = "Address"
Note:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12613) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Excel here: Inserting Worksheet Values with a Macro.
Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!
It can be frustrating when you get error messages doing something that you previously did with no errors. If you get an ...
Discover MoreUsing a macro to add worksheets to your workbook is easy. This tip provides two different methods you can use.
Discover MoreOne of the most basic of programming structures is the conditional structure: If ... End If. This tip explains how this ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2023-12-16 11:09:22
J. Woolley
Value is the default property of a Range object, so the Tip's examples can be coded like this:
Cells(1, 1) = 23
Range("C4") = "Address"
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments