Change the values of the whole column

sanderx01

New Member
Joined
Jul 21, 2017
Messages
5
Hi Guys,

Good day!

I just want to ask, because I have this problem.

I want to change the value of the whole column by entering a value from the other cell.

Example:

If I input 1 to Cell B1, the whole value of Column A1:A25 will change its values.
Again, If I input 2 to cell B1, the whole value of Column A1:A25 will change its values.

Thank you in advance!

Alexander
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Try this:
This is an auto sheet event script
Your Workbook must be Macro enabled
To install this code:
Right-click on the sheet tab
Select View Code from the pop-up context menu
Paste the code in the VBA edit window

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("B1")) Is Nothing Then
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Range("A1:A" & Lastrow).Value = Target.Value
End If
End Sub
 
Last edited:
Upvote 0
And to what should the values be changed?

Example:

When I input 1 at B1 Cell, that is the value for the column A.

[TABLE="width: 200"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]0[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]2
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]10[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]12[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]6[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]0[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Then, when I input 2 at B1 Cell, that is not the new value for Column A

[TABLE="width: 200"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]0[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]8[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]9[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]13[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]14[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]8[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]7[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]3[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


I hope you can help me with this.

Kind Regards!

Alexander
 
Upvote 0
So my script did not work I assume.

I do not understand what you want and post #4 did not help.
Are you wanting a Vba solution?
 
Upvote 0
Sorry, I did not try it yet.

Once I am done with it. I'll try to feed you back.

Thank you for helping me out. Really appreciated.

Cheers!
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top