Hi once more:

I have a workbook that includes a macro - created with some
considerable help from Otto Moerback, one of the regular contributors
to this group. The macro sequentially copies a named range from a
group of worksheets and pastes the VALUES of the copied data into the
workbook that contains the macro. This code works perfectly. The
current code is as follows:

Option Explicit
Dim wbThis As Workbook
Dim wbOther As Workbook
Dim PathsList As Range
Dim i As Range
Dim ThePath As String
Dim TheFile As String

Sub MakeDatabase()
With Sheets("FOLDERS")
Set PathsList = .Range("A2", .Range("A" &
Rows.Count).End(xlUp))
End With
Set wbThis = ThisWorkbook
For Each i In PathsList
ThePath = i.Value
ChDir ThePath
TheFile = Dir("*.xls")
Do While TheFile <> ""
Application.EnableEvents = False
Set wbOther = Workbooks.Open(ThePath & "\" &
TheFile)
Sheets("DATABASE").Select
Application.EnableEvents = True
With wbThis.Sheets("DATA")
Range("DISTFEED").Copy
.Range("A6").End(xlDown).Offset(1,
0).PasteSpecial Paste:=xlPasteValues


End With
wbOther.Close SaveChanges:=False
TheFile = Dir
Loop
Next i
End Sub

Now I need to copy the actual data rather than the values of the
data. I have tried simply changing the line of code where the pasting
is done to the following:

.Range("A6").End(xlDown).Offset(1, 0).Paste

I now get the following error message on this modified line of code:

Run-time error '438'
Object doesn't support this property or method

Any advice would be most appreciated.

TIA

Crownman

Re: Another macro Question by Don

Don
Thu Oct 09 09:34:40 CDT 2008

Try it with just this ONE line
Range("DISTFEED").Copy .Range("A6").End(xlDown).Offset(1)


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com
"Crownman" <crownman451@sbcglobal.net> wrote in message
news:e93fb840-f05e-4f2f-92dd-539fa13e67a0@2g2000hsn.googlegroups.com...
> Hi once more:
>
> I have a workbook that includes a macro - created with some
> considerable help from Otto Moerback, one of the regular contributors
> to this group. The macro sequentially copies a named range from a
> group of worksheets and pastes the VALUES of the copied data into the
> workbook that contains the macro. This code works perfectly. The
> current code is as follows:
>
> Option Explicit
> Dim wbThis As Workbook
> Dim wbOther As Workbook
> Dim PathsList As Range
> Dim i As Range
> Dim ThePath As String
> Dim TheFile As String
>
> Sub MakeDatabase()
> With Sheets("FOLDERS")
> Set PathsList = .Range("A2", .Range("A" &
> Rows.Count).End(xlUp))
> End With
> Set wbThis = ThisWorkbook
> For Each i In PathsList
> ThePath = i.Value
> ChDir ThePath
> TheFile = Dir("*.xls")
> Do While TheFile <> ""
> Application.EnableEvents = False
> Set wbOther = Workbooks.Open(ThePath & "\" &
> TheFile)
> Sheets("DATABASE").Select
> Application.EnableEvents = True
> With wbThis.Sheets("DATA")
> Range("DISTFEED").Copy
> .Range("A6").End(xlDown).Offset(1,
> 0).PasteSpecial Paste:=xlPasteValues
>
>
> End With
> wbOther.Close SaveChanges:=False
> TheFile = Dir
> Loop
> Next i
> End Sub
>
> Now I need to copy the actual data rather than the values of the
> data. I have tried simply changing the line of code where the pasting
> is done to the following:
>
> .Range("A6").End(xlDown).Offset(1, 0).Paste
>
> I now get the following error message on this modified line of code:
>
> Run-time error '438'
> Object doesn't support this property or method
>
> Any advice would be most appreciated.
>
> TIA
>
> Crownman


Re: Another macro Question by Crownman

Crownman
Thu Oct 09 10:00:01 CDT 2008

On Oct 9, 9:34=A0am, "Don Guillett" <dguille...@austin.rr.com> wrote:
> Try it with just this ONE line
> Range("DISTFEED").Copy .Range("A6").End(xlDown).Offset(1)
>
> --
> Don Guillett
> Microsoft MVP Excel
> SalesAid Software
> dguille...@austin.rr.com"Crownman" <crownman...@sbcglobal.net> wrote in m=
essage
>
> news:e93fb840-f05e-4f2f-92dd-539fa13e67a0@2g2000hsn.googlegroups.com...
>
>
>
> > Hi once more:
>
> > I have a workbook that includes a macro - created with some
> > considerable help from Otto Moerback, one of the regular contributors
> > to this group. =A0The macro sequentially copies a named range from a
> > group of worksheets and pastes the VALUES of the copied data into the
> > workbook that contains the macro. =A0This code works perfectly. =A0The
> > current code is as follows:
>
> > Option Explicit
> > Dim wbThis As Workbook
> > Dim wbOther As Workbook
> > Dim PathsList As Range
> > Dim i As Range
> > Dim ThePath As String
> > Dim TheFile As String
>
> > Sub MakeDatabase()
> > =A0 =A0 =A0With Sheets("FOLDERS")
> > =A0 =A0 =A0 =A0 =A0 =A0Set PathsList =3D .Range("A2", .Range("A" &
> > Rows.Count).End(xlUp))
> > =A0 =A0 =A0End With
> > =A0 =A0 =A0Set wbThis =3D ThisWorkbook
> > =A0 =A0 =A0For Each i In PathsList
> > =A0 =A0 =A0 =A0 =A0 =A0ThePath =3D i.Value
> > =A0 =A0 =A0 =A0 =A0 =A0ChDir ThePath
> > =A0 =A0 =A0 =A0 =A0 =A0TheFile =3D Dir("*.xls")
> > =A0 =A0 =A0 =A0 =A0 =A0Do While TheFile <> ""
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Application.EnableEvents =3D False
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Set wbOther =3D Workbooks.Open(ThePa=
th & "\" &
> > TheFile)
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Sheets("DATABASE").Select
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Application.EnableEvents =3D True
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0With wbThis.Sheets("DATA")
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Range("DISTFEED").Copy
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0.Range("A6").End(xlDown)=
.Offset(1,
> > 0).PasteSpecial Paste:=3DxlPasteValues
>
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0End With
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0wbOther.Close SaveChanges:=3DFalse
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0TheFile =3D Dir
> > =A0 =A0 =A0 =A0 =A0 =A0Loop
> > =A0 =A0 =A0Next i
> > End Sub
>
> > Now I need to copy the actual data rather than the values of the
> > data. =A0I have tried simply changing the line of code where the pastin=
g
> > is done to the following:
>
> > .Range("A6").End(xlDown).Offset(1, 0).Paste
>
> > I now get the following error message on this modified line of code:
>
> > Run-time error '438'
> > Object doesn't support this property or method
>
> > Any advice would be most appreciated.
>
> > TIA
>
> > Crownman- Hide quoted text -
>
> - Show quoted text -

Don:

That worked perfectly. Thank you for your help.

Crownman

Re: Another macro Question by Don

Don
Thu Oct 09 10:23:30 CDT 2008

Glad to help

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com
"Crownman" <crownman451@sbcglobal.net> wrote in message
news:74a7944e-510e-4a90-88c6-eea6ab8a4f0b@s20g2000prd.googlegroups.com...
On Oct 9, 9:34 am, "Don Guillett" <dguille...@austin.rr.com> wrote:
> Try it with just this ONE line
> Range("DISTFEED").Copy .Range("A6").End(xlDown).Offset(1)
>
> --
> Don Guillett
> Microsoft MVP Excel
> SalesAid Software
> dguille...@austin.rr.com"Crownman" <crownman...@sbcglobal.net> wrote in
> message
>
> news:e93fb840-f05e-4f2f-92dd-539fa13e67a0@2g2000hsn.googlegroups.com...
>
>
>
> > Hi once more:
>
> > I have a workbook that includes a macro - created with some
> > considerable help from Otto Moerback, one of the regular contributors
> > to this group. The macro sequentially copies a named range from a
> > group of worksheets and pastes the VALUES of the copied data into the
> > workbook that contains the macro. This code works perfectly. The
> > current code is as follows:
>
> > Option Explicit
> > Dim wbThis As Workbook
> > Dim wbOther As Workbook
> > Dim PathsList As Range
> > Dim i As Range
> > Dim ThePath As String
> > Dim TheFile As String
>
> > Sub MakeDatabase()
> > With Sheets("FOLDERS")
> > Set PathsList = .Range("A2", .Range("A" &
> > Rows.Count).End(xlUp))
> > End With
> > Set wbThis = ThisWorkbook
> > For Each i In PathsList
> > ThePath = i.Value
> > ChDir ThePath
> > TheFile = Dir("*.xls")
> > Do While TheFile <> ""
> > Application.EnableEvents = False
> > Set wbOther = Workbooks.Open(ThePath & "\" &
> > TheFile)
> > Sheets("DATABASE").Select
> > Application.EnableEvents = True
> > With wbThis.Sheets("DATA")
> > Range("DISTFEED").Copy
> > .Range("A6").End(xlDown).Offset(1,
> > 0).PasteSpecial Paste:=xlPasteValues
>
> > End With
> > wbOther.Close SaveChanges:=False
> > TheFile = Dir
> > Loop
> > Next i
> > End Sub
>
> > Now I need to copy the actual data rather than the values of the
> > data. I have tried simply changing the line of code where the pasting
> > is done to the following:
>
> > .Range("A6").End(xlDown).Offset(1, 0).Paste
>
> > I now get the following error message on this modified line of code:
>
> > Run-time error '438'
> > Object doesn't support this property or method
>
> > Any advice would be most appreciated.
>
> > TIA
>
> > Crownman- Hide quoted text -
>
> - Show quoted text -

Don:

That worked perfectly. Thank you for your help.

Crownman