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

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.

Follow below given steps:-

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

  • 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

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

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

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

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.


Add a Comment

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