Copying Data based on number from one sheet to another

Closed
Aivaras - Mar 18, 2015 at 03:43 PM
MaxStart Posts 340 Registration date Tuesday March 3, 2015 Status Moderator Last seen July 3, 2015 - Mar 21, 2015 at 10:37 PM
Hello,

I would really like a VBA CODE which would help me to copy Data based on number from one sheet to another:

So I have 5 projects(sheet1,sheet2,..) and 1 sheet for email address ( Company.Name,Email)

And each month I need to put some of the emails to the different projects, sometimes even same company for a couple of projects. I was wondering to numbered all emails, something like

NR. Company Name Email
1 Comp1 Name1 Email1
2 Comp2 Name2 Email2

so each time for example I would need company 2 for project 1 I would just write NR2 in Project1 sheet cell and three cells from Email sheet with information would copy with it.

Any suggestions ? I would be most grateful for it guys.

1 reply

MaxStart Posts 340 Registration date Tuesday March 3, 2015 Status Moderator Last seen July 3, 2015 69
Mar 21, 2015 at 10:37 PM
Private Sub Worksheet_Change(ByVal Target As Range)
    
    If Cells(Target.Row, Target.Column).Value = "nar1" Then
    Cells(Target.Row, Target.Column).Value = Sheet2.Cells(1, 1).Value
    Cells(Target.Row, Target.Column + 1).Value = Sheet2.Cells(1, 1 + 1).Value
    Cells(Target.Row, Target.Column + 2).Value = Sheet2.Cells(1, 1 + 2).Value
    ElseIf Cells(Target.Row, Target.Column).Value = "nar2" Then
    Cells(Target.Row, Target.Column).Value = Sheet2.Cells(2, 1).Value
    Cells(Target.Row, Target.Column + 1).Value = Sheet2.Cells(2, 1 + 1).Value
    Cells(Target.Row, Target.Column + 2).Value = Sheet2.Cells(2, 1 + 2).Value
    End If

End Sub

0