Change only the CurrentRegion of the ActiveCell to values using VBA in Microsoft Excel

In this article we will learn how to change only the current region of the active cell to values using VBA in Microsoft Excel.

Let’s take an example and understand how to change only the current region of the active cell to values.

How to change the value of current region?

We have data in Excel in which Column A contains some values and Column B also contains some values.  We are going to update the same value of column B in the current region.

image 1

 

Follow below given steps:-

  • Press Alt+F11 key to open the Visual Basic Application

image 2

 

  • In VBA Project Double click on Sheet 1
  • Enter the below given VBA Code

 

Sub Values_2()

With ActiveCell.CurrentRegion

.Value = Range("B1:B10").Value

End With

End Sub

 

image 3

 

  • Select cell A1
  • To run the code press F5 key
  • Only first cell value will get updated in the data

image 4

 

Now let’s change the selection and see the results:

image 5

 

  • Select the range C1:C10
  • Then press F5 to run the code

image 6

 

image 48

 

If you liked our blogs, share it with your friends on Facebook. And also you can follow us on Twitter and Facebook.

We would love to hear from you, do let us know how we can improve, complement or innovate our work and make it better for you. Write us at info@exceltip.com

 
 

Leave a Reply

Your email address will not be published. Required fields are marked *

Terms and Conditions of use

The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.

Visit Us On TwitterVisit Us On FacebookVisit Us On Youtube