Q: Excel - Autofill columns based on input in one cell 
In excel, when I enter "A" in "Input Column", I want, Harry, Josh, Rob and Peter to be auto filled as shown in the picture. 
Similarly, when I enter "B" in Input Column", I want Kim, Nancy, Paul, George to be auto filled. Can anyone post the VBA code to do this or can I do it with formulas themselves? 

A: An automated code solution:


*

*Right click your sheet tab and select View Code

*Copy and paste in the code below

*Press Alt+F11 to go back to Excel


This code makes the changes you require whenever one or more cells in Column A (ie your "Target Columm") is changed
To use Column B instead try
Set rng1 = Intersect(Target, Columns("B"))
etc
code
    Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng1 As Range
Dim rng2 As Range
Set rng1 = Intersect(Target, Columns("A"))
If rng1 Is Nothing Then Exit Sub
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
For Each rng2 In rng1
Select Case UCase$(rng2.Value)
Case "A"
rng2.Offset(0, 1).Resize(1, 2) = Array("Harry", "Josh")
rng2.Offset(1, 1).Resize(1, 2) = Array("Rob", "Peter")
Case "B"
rng2.Offset(0, 1).Resize(1, 2) = Array("Kim", "Nancy")
rng2.Offset(1, 1).Resize(1, 2) = Array("Paul", "George")
End Select
Next
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
End Sub

