copy data from new worksheet to master list

T

Texas Aggie

am creating an application that has three master sheets and a template. Sheet
2 holds the data for an unknown list of sheets. I have a userform that allows
the user to copy the template worksheet and give it a unique name. That name
is stored in the database on sheet two. Sheet 2 looks like this.

A B C D
1. Sheet Name Data 1 Data 2 Data 3
2. New Sheet1 NewSheet1!A1 NewSheet1!B1 NewSheet1!C1

I need to figure out how to take data from the new sheet's Cell A1 B1 and C1
and copy it to it's corresponding position on the database in Sheet 2. I hope
that I explained it well. Any help would be appreciated.
 
T

Texas Aggie

After doing some more research I come upon the solution to my own problem

The code is:

Sub test()

Dim c As Range
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("Sheet 2")

With ws
For Each c In Application.Intersect(.UsedRange, .Range("A2:A100"))
If c.Value = "" Then

Else
c.Offset(0, 1).Value = "='" & c.Value & "'!A1"
c.Offset(0, 2).Value = "='" & c.Value & "'!B1"


End If
Next c

End With
End Sub
 

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