To change cell value automatically
Solved/Closed
Related:
- To change cell value automatically
- How to change computer name - Guide
- How to change lg tv name - Guide
- How to change idm language - Guide
- How to change date format in excel - Guide
- How to change email on facebook - Guide
4 responses
TrowaD
Posts
2921
Registration date
Sunday 12 September 2010
Status
Contributor
Last seen
27 December 2022
555
15 Feb 2016 à 11:43
15 Feb 2016 à 11:43
Hi Dhanuj,
Welcome to this forum!
Use the following code:
To use this code:
- Hit Alt+F11 to open a new window.
- On the left side, find Sheet1 and double click it.
- Paste the code in the big white field.
- Close the (newly) opened window.
Best regards,
Trowa
Welcome to this forum!
Use the following code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A1:A2")) Is Nothing Then Exit Sub
If Range("A1").Value = 1 Then Range("A1").Value = "Apple"
If Range("A2").Value = 2 Then Range("A2").Value = "Orange"
End Sub
To use this code:
- Hit Alt+F11 to open a new window.
- On the left side, find Sheet1 and double click it.
- Paste the code in the big white field.
- Close the (newly) opened window.
Best regards,
Trowa
TrowaD
Posts
2921
Registration date
Sunday 12 September 2010
Status
Contributor
Last seen
27 December 2022
555
18 Feb 2016 à 10:56
18 Feb 2016 à 10:56
Hi Dhanuj,
Ok, for that request use the following code:
Best regards,
Trowa
Ok, for that request use the following code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Columns("A:A")) Is Nothing Then Exit Sub
If Target.Value = 1 Then Target.Value = "Apple"
If Target.Value = 2 Then Target.Value = "Orange"
End Sub
Best regards,
Trowa
Hi TrowaD,
This is my last question about this topic. What is the macro to use same kind of function in Column B as well?
Column A should change as
1 = Apple
2 = Orange
Column B should change as
1 = Banana
2 = Grapes
Earlier you provided me the solution for Column A and it works good. Thanks for that. With this answer, my query will be solved about this topic.
This is my last question about this topic. What is the macro to use same kind of function in Column B as well?
Column A should change as
1 = Apple
2 = Orange
Column B should change as
1 = Banana
2 = Grapes
Earlier you provided me the solution for Column A and it works good. Thanks for that. With this answer, my query will be solved about this topic.
TrowaD
Posts
2921
Registration date
Sunday 12 September 2010
Status
Contributor
Last seen
27 December 2022
555
22 Feb 2016 à 11:59
22 Feb 2016 à 11:59
Hi Dhanuj,
And for that request use the following code:
Does this solve this topic ... ? ;)
Best regards,
Trowa
And for that request use the following code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Columns("A:A")) Is Nothing Then
If Target.Value = 1 Then Target.Value = "Apple"
If Target.Value = 2 Then Target.Value = "Orange"
ElseIf Not Intersect(Target, Columns("B:B")) Is Nothing Then
If Target.Value = 1 Then Target.Value = "Banana"
If Target.Value = 2 Then Target.Value = "Grapes"
End If
End Sub
Does this solve this topic ... ? ;)
Best regards,
Trowa
16 Feb 2016 à 04:19
Thanks for your answer. It worked. Cell A1 is selected and Value 1 is entered and it changes to "Apple" automatically as per your previous answer. Now I need it as a extended option. If we enter Value 1 anywhere in Column A, it should change as Apple in the respective cell in which we are entering that Value. Thanks in advance.
16 Feb 2016 à 11:28
Just to be clear:
Enter "1" in column A --> automatic change to "Apple".
Enter "2" in A2 --> automatic change to "Orange".
Is this what you are after?
Best regards,
Trowa
16 Feb 2016 à 20:45
Yes that's what I have asked earlier and you have solved my issue and thanks for that. Now this is an another question.
Entering value 1 in any row of A column should change as Apple in the respective cell and Value 2 in any row of A column should change as Orange in the respective cell. Kindly help me on this regard.
Thanks in advance.