Macro to import multiple sheets

  • Follow


Please disregard my previous posting.. I explained it very badly !!!!

I have a macro that will let me search for the location of an Excel file and 
import the data from that file- 

Dim wb As Workbook
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Application.Dialogs(xlDialogOpen).Show ThisWorkbook.Path
Set wb = ActiveWorkbook
wb.ActiveSheet.Range("A4:E30").Copy _
ThisWorkbook.Sheets("Non Account Activity - Brokaw").Range("CA4")
wb.Close False
Application.DisplayAlerts = True
Application.ScreenUpdating = True


What I would like to do is modify this so that I can source 2 different 
sheets in the same file and have the data from both of them 
imported at the same time.. 

Is this possbile ?





-- 
Thanks

Larry 
0
Reply Utf 2/11/2010 9:35:01 PM

Hi
You need 2 copies of this line

wb.ActiveSheet.Range("A4:E30").Copy _
ThisWorkbook.Sheets("Non Account Activity - Brokaw").Range("CA4")

replace Activesheet with Worksheets("TheSheetName") in each case and
the range info as required.
regards
Paul

On Feb 11, 9:35=A0pm, Larry Fitch <LarryFi...@discussions.microsoft.com>
wrote:
> Please disregard my previous posting.. I explained it very badly !!!!
>
> I have a macro that will let me search for the location of an Excel file =
and
> import the data from that file-
>
> Dim wb As Workbook
> Application.DisplayAlerts =3D False
> Application.ScreenUpdating =3D False
> Application.Dialogs(xlDialogOpen).Show ThisWorkbook.Path
> Set wb =3D ActiveWorkbook
> wb.ActiveSheet.Range("A4:E30").Copy _
> ThisWorkbook.Sheets("Non Account Activity - Brokaw").Range("CA4")
> wb.Close False
> Application.DisplayAlerts =3D True
> Application.ScreenUpdating =3D True
>
> What I would like to do is modify this so that I can source 2 different
> sheets in the same file and have the data from both of them
> imported at the same time..
>
> Is this possbile ?
>
> --
> Thanks
>
> Larry

0
Reply paul 2/11/2010 9:57:33 PM


Thanks Very much Paul !!!

That did the trick !!
-- 
Thanks

Larry 


"paul.robinson@it-tallaght.ie" wrote:

> Hi
> You need 2 copies of this line
> 
> wb.ActiveSheet.Range("A4:E30").Copy _
> ThisWorkbook.Sheets("Non Account Activity - Brokaw").Range("CA4")
> 
> replace Activesheet with Worksheets("TheSheetName") in each case and
> the range info as required.
> regards
> Paul
> 
> On Feb 11, 9:35 pm, Larry Fitch <LarryFi...@discussions.microsoft.com>
> wrote:
> > Please disregard my previous posting.. I explained it very badly !!!!
> >
> > I have a macro that will let me search for the location of an Excel file and
> > import the data from that file-
> >
> > Dim wb As Workbook
> > Application.DisplayAlerts = False
> > Application.ScreenUpdating = False
> > Application.Dialogs(xlDialogOpen).Show ThisWorkbook.Path
> > Set wb = ActiveWorkbook
> > wb.ActiveSheet.Range("A4:E30").Copy _
> > ThisWorkbook.Sheets("Non Account Activity - Brokaw").Range("CA4")
> > wb.Close False
> > Application.DisplayAlerts = True
> > Application.ScreenUpdating = True
> >
> > What I would like to do is modify this so that I can source 2 different
> > sheets in the same file and have the data from both of them
> > imported at the same time..
> >
> > Is this possbile ?
> >
> > --
> > Thanks
> >
> > Larry
> 
> .
> 
0
Reply Utf 2/12/2010 1:54:01 PM

2 Replies
444 Views

(page loaded in 0.251 seconds)

Similiar Articles:
















7/20/2012 10:41:49 PM


Reply: