Change a Row or Rows to values to values using VBA in Microsoft Excel

We write the VBA coding to allow the Excel to do the repetitive work automatically within less time. In this chapter you will learn about how to change a row(s) to value(s) using VBA in Microsoft Excel.

Let’s take an example and understand how to write the VBA code for change a row(s) to value(s) using VBA.

How to change rows value to rows value?

We have data in Excel, in which we want the change the 1st rows value to 2nd rows value.

 

image 1

 

Follow below given steps:-

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

image 2

 

  • In VBAProject Double click on Sheet 1
  • Enter the below given VBA Code
Sub Values_6()

Rows("1").Value = Rows("2").Value

End Sub

 

image 3

 

  • To run the code press F5 key
  • 1st Row value will get update in the 2nd row value

image 4

 

How the change the multiple row values from other multiple row values?

We have 2 groups of row values, we want to change the 1st group value with the 2nd group value.

image 5

 

To change the value follow below given steps and code:-

  • Open the Visual Basic Application
  • Enter the code below:-

 

Sub Values_7()

Rows("1:3").Value = Rows("5:7").Value

End Sub

 

image 6

 

  • Run the code by pressing the F5
  • Row Values will get update

 

image 7

 

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.