Copying data from cells A1,B1,C1 on tab1 to tab2

D

dannynic

I want to copy data from cells A, B and C on Tab 1 of my workbook to other
tabs in my workbook dependant on which option is selected from a dropdown
list in cell D of Tab1

Example:
I have 'company name' in cell A, 'Account Number' in Cell B and 'Sales' in
cell C on tab 1, I then select 'Blue' from a dropdown list in cell D on tab
1. I then want excel to copy the data in cells A, B and C, on tab 1 into
another tab in the same workbook named 'Blue'.

can anybody help please????
 
J

Jacob Skaria

Select the sheet tab which you want to work with. Right click the sheet tab
and click on 'View Code'. This will launch VBE. Paste the below code to the
right blank portion. Get back to to workbook and try out.


Private Sub Worksheet_Change(ByVal Target As Range)
Dim lngLastRow As Long
Application.EnableEvents = False
If Target.Column = 4 And Target.Count = 1 Then
If Target.Text <> "" Then
lngRow = Sheets(CStr(Target.Text)).Cells(Rows.Count, "A").End(xlUp).Row + 1
Me.Range("A" & Target.Row).Resize(, 3).Copy _
Sheets(CStr(Target.Text)).Range("A" & lngRow)
End If
End If
Application.EnableEvents = True
End Sub

If this post helps click Yes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top