In this chapter you will learn how to change all the cells in the active sheet to values using VBA in Microsoft Excel.
Let’s take an example and understand how we write the VBA code for change the cells value in Active sheet.
How to change all the cells value in the Active sheet?
We have data in Excel, in which we want the replace all the cells value with only a cell value.
Follow below given steps:-
Sub Values_1() With ActiveSheet.UsedRange Range("A1:I7").Value = Range("A2").Value End With End Sub
How the change the value from first table to second table?
We have 2 tables, 1st table’s range is A3:I5, and 2nd table range is A8:I10. We want to replace the value of 1st table with the value of 2 table in the active sheet.
To change the value follow below given steps and code:-
Sub Values_1() With ActiveSheet.UsedRange Range("A3:I5").Value = Range("A8:I10").Value End With End Sub
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 email@example.com
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.