# Put Data into a Worksheet using a Macro in Excel

Author:

How to input data into cells in a worksheet from a macro.

Once you have data in your macro and you do something with it, you need to be able to put it back into Excel so you can see it or store it.

This tutorial assumes that you have read and are familiar with the last tutorial: Get Data from the Worksheet into a Macro in Excel

### Sections:

Putting Data from a Macro into the Worksheet

Putting Data from One Cell into Another Cell Using a Macro

Notes

## Putting Data from a Macro into the Worksheet

Putting data into a cell is as simple as setting the value of that cell equal to the data.

(If you don't already know how to reference cells in a macro, click that link to learn about it.)

Let's put "This is my data." into cell A1.

1. Create some data in the macro. Here, I set the variable mydata equal to some text.
2. Enter the location of the cell where the data will go: 3. Type .Value after it 4. Set it equal to the variable that has the data that we want to go into that cell. You can see this was done using a simple equal's sign and the name of the variable.
5. Go back to Excel, run the macro, and that's it! As you can see, it is quite simple to put data into a cell; you only need to know the location of the cell and then set its value equal to something.

## Putting Data from One Cell into Another Cell Using a Macro

If you don't need to do anything with the data in the macro, you can simply transfer it from one cell to another cell quickly and easily like this:

``````Range("B3").Value = Range("A1").Value
`````` This macro gets the data from cell A1 and puts it into cell B3.

After you run the macro, Excel will look like this: This follows the same format as above except that we get the data directly from another cell.

## Notes

#### Question? Ask it in our Excel Forum

Our Excel Courses

#### Professional Input Forms in Excel • Skill Level: All Levels
• |
• 5 hours+

How to make a fully featured professional form in Excel that is unbreakable. This includes how to use the form to store, view, edit, and delete data from a data storage worksheet.

#### Send Emails from Excel (Multiple Methods) • Skill Level: All Levels
• |
• 2 hours

Send Emails from Excel using VBA and Macros. This course starts from the Basics and builds up to more advanced examples with attaching workbooks, worksheets, PDF's, automatically sending emails, including a signature, error handling, increasing speed, and more.

Similar Content on TeachExcel
Activate or Navigate to a Worksheet using Macros VBA in Excel
Tutorial: Make a particular worksheet visible using a macro in Excel. This is called activating a wo...
Excel Data Validation - Limit What a User Can Enter into a Cell
Tutorial: Data Validation is a tool in Excel that you can use to limit what a user can enter into a...
Put Data into a UserForm
Tutorial: How to take data from Excel and put it into a UserForm. This is useful when you use a form...
Get the Name of a Worksheet in Macros VBA in Excel
Tutorial: How to get the name of a worksheet in Excel using VBA and Macros and also how to store tha...
Create a Column Chart with a Macro in Excel
Macro: This macro adds a column chart to Excel. This is an easy to use macro that allows you to q...
Create a Bar Chart With a Macro in Excel
Macro: Create a bar chart in Excel with this macro. You will be able to quickly and easily turn a...
Tutorial Details