Copying from one workbook to multiple workbook

D

drinese18

I am basically trying to copy a range of data from one workbook to about 3
other. I have already written code that allows me to find the data according
to the date I entered and then paste it into another worksheet, my code can
be seen below:


Option Explicit

Private Sub CommandButton1_Click()
Dim rng1 As Range
Dim rngFound As Range


With Worksheets("Index")
Set rng1 = .Range("A1:A" & .Range("A65536").End(xlDown).Row)
End With
Set rngFound = rng1.Find(what:=DateValue(Me.TextBox1.Value))
Range(rngFound, rngFound.Offset(1, 8)).Copy
Worksheets("Sheet2").Range("A1")
Set rngFound = Nothing
Unload Me
End
End Sub

But instead of copying from one worksheet to another, I want it to copy from
one workbook to multiple workbooks according to the date I entered within the
UserForm, any help will be appreciated thank you.
 
D

Dave Peterson

You could use multiple lines:

Range(rngFound, rngFound.Offset(1, 8)).Copy _
workbooks("book1.xls").Worksheets("Sheet2").Range("A1")

Range(rngFound, rngFound.Offset(1, 8)).Copy _
workbooks("book2.xls").Worksheets("Sheet2").Range("A1")

Range(rngFound, rngFound.Offset(1, 8)).Copy _
workbooks("book3.xls").Worksheets("Sheet2").Range("A1")

Each of those files need to be open.
 
D

drinese18

Yeh I could but in that case I would like it to basically take whatever I
entered in the box, use it to find the data within the source workbook, once
the data is found, it will then copy it to the other 3 workbooks.
 
D

drinese18

I mean if not, i can just make it less complicated, still I don't remember
the simple copy/paste code that enables you to copy a range from one workbook
to the next, thats all I want really, to be able to automatically copy and
paste from one workbook to multiple workbooks at a touch of a button
 

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