PC Review


Reply
Thread Tools Rate Thread

Copying from one workbook to multiple workbook

 
 
drinese18
Guest
Posts: n/a
 
      15th Jan 2008
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.

 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      15th Jan 2008
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.

drinese18 wrote:
>
> 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.


--

Dave Peterson
 
Reply With Quote
 
drinese18
Guest
Posts: n/a
 
      15th Jan 2008
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.

"Dave Peterson" wrote:

> 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.
>
> drinese18 wrote:
> >
> > 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.

>
> --
>
> Dave Peterson
>

 
Reply With Quote
 
drinese18
Guest
Posts: n/a
 
      15th Jan 2008
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

"drinese18" wrote:

> 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.
>
> "Dave Peterson" wrote:
>
> > 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.
> >
> > drinese18 wrote:
> > >
> > > 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.

> >
> > --
> >
> > Dave Peterson
> >

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      15th Jan 2008
I don't know of anything less complicated than using those three lines.

drinese18 wrote:
>
> 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
>
> "drinese18" wrote:
>
> > 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.
> >
> > "Dave Peterson" wrote:
> >
> > > 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.
> > >
> > > drinese18 wrote:
> > > >
> > > > 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.
> > >
> > > --
> > >
> > > Dave Peterson
> > >


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying multiple worksheets to another workbook Chris Maddogz Microsoft Excel Programming 11 28th May 2009 07:00 AM
Copying range from selected workbook to open workbook John Microsoft Excel Programming 2 11th Aug 2007 03:49 PM
copying worksheets to a new workbook without formulae referencing original workbook pjdeeb@gmail.com Microsoft Excel Programming 2 16th Oct 2006 07:31 PM
Copying data from workbook/sheets to another workbook/sheet =?Utf-8?B?eXVrb25fcGhpbA==?= Microsoft Excel Programming 0 26th Jul 2006 07:33 PM
loop through a column on a workbook copying data on each row to another workbook, then copy data back to the original workbook burl_rfc Microsoft Excel Programming 1 1st Apr 2006 08:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:26 AM.