How To Change the selection with one or more areas to values using VBA in Excel?
Tags: tochangetheselection, vbamacros
Published: 2021-10-19 10:08:12

---
title: How To Change the selection with one or more areas to values using VBA in Excel?
published: true
date: 2021-10-18 11:26:24 UTC
tags: ToChangeTheSelection,VBAMacros
canonical_url: https://geekexcel.com/how-to-change-the-selection-with-one-or-more-areas-to-values-using-vba-in-excel/
---

In this tutorial, we will guide you on how to  **change the selection with one or more areas to values using VBA ** in Excel. Let’s get them below!! Get an official version of MS Excel from the following link: **[https://www.microsoft.com/en-in/microsoft-365/excel](https://www.microsoft.com/en-in/microsoft-365/excel)**

## Example

- Firstly, you need to **create a sample data** in Excel Spreadsheet.

![](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/10/Sample-data-26.png)<figcaption>Sample data</figcaption>

- In the Excel Worksheet, you have to go to the  **Developer Tab.**
- Then, you need to ** ** select the  **Visual Basic**  option under the  **Code**  section.

![Select Visual Basic](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/09/Select-Visual-Basic-9-1024x180.png)<figcaption>Select Visual Basic</figcaption>

- Now, you have to  **copy and paste the code**  given below.

```
Sub Values_10()
Dim smallrng As Range
For Each smallrng In Selection.Areas
smallrng.Value = Range("A1:A5").Value
Next
End Sub
```

- After that, you need to  **save the code**  by selecting it and then  **close the window**.

![](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/10/Save-the-Code-54.png)<figcaption>Save the Code</figcaption>

- Again, you have to go to the  **Excel Spreadsheet** , and click on the  **Developer Tab**.
- Then, you need to choose the  **Macros option**  in the Code section.

![Choose Macro option](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/09/Choose-Macro-option-11-1024x184.png)<figcaption>Choose Macro option</figcaption>

- Now, you have to **select the range E1:E13**.

![](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/10/Select-the-range-1.png)<figcaption>Select the Range</figcaption>

- After that, you have to make sure that your  **macro name is selected**  and click the  **Run ** button.

![](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/10/Run-the-Code-45.png)<figcaption>Run the Code</figcaption>

- Finally, after running the macro, you will get **output** as given below in Excel.

![](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/10/Output-27.png)<figcaption>Output</figcaption>

## Verdict

We hope that this tutorial gives you guidelines on how to  **change the selection with one or more areas to values using VBA**  in Excel. Please leave a comment in case of any  **queries,**  and don’t forget to mention your valuable  **suggestions**  as well. Thank you so much for Visiting Our Site!! Continue learning on **[Geek Excel](https://geekexcel.com/)!! **Read more on [**Excel Formulas**](https://geekexcel.com/excel-formula/) **!!**

**Keep Reading:**

- **[Use Excel AREAS Function in Office 365 In Easy Ways!!](https://geekexcel.com/use-areas-function-in-microsoft-excel-365-in-easy-ways/)**
- **[How to Highlight When Line Drops or Peaks in Comparison Excel Chart?](https://geekexcel.com/how-to-highlight-when-line-drops-or-peaks-in-comparison-excel-chart/)**
- **[How to Change the Date Format in Excel Office 365? ~ Complete Guide!!](https://geekexcel.com/change-date-format-in-excel/)**
- **[Change the Time Format in Excel Office 365 ~ Useful Guide!!](https://geekexcel.com/change-the-time-format-in-excel/)**