ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy cell data Workbook to Workbook (https://www.excelbanter.com/excel-programming/322154-copy-cell-data-workbook-workbook.html)

Soli3d

Copy cell data Workbook to Workbook
 
Hello,

I am trying to copy the contents of the
active sheet in the active workbook to
sheet1 of a second named workbook.

I get an error when starting loop to
check each cell[range] in the Active
Sheet.

What am I doing wrong? Much Thanks...

Paul


Dim oRange As Range

Dim MatrixWB As Workbook
Dim ActiveWB As Workbook

Set MatrixWB = Application.Workbooks("AssemblyMatrix.xls")
Set ActiveWB = Application.ActiveWorkbook
'Error when trying to check each cell in the Active sheet?
For Each oRange In ActiveWB.ActiveSheet

If Not oRange.Value = "" Then
With MatrixWB.Sheets("Sheet1")
.Cells(oRange.Row, oRange.Column).Value = _
oRange.Value
End With
End If

Next oRange

Tom Ogilvy

Copy cell data Workbook to Workbook
 
For Each oRange In ActiveWB.ActiveSheet.UsedRange

--
Regards,
Tom Ogilvy

"Soli3d" wrote in message
...
Hello,

I am trying to copy the contents of the
active sheet in the active workbook to
sheet1 of a second named workbook.

I get an error when starting loop to
check each cell[range] in the Active
Sheet.

What am I doing wrong? Much Thanks...

Paul


Dim oRange As Range

Dim MatrixWB As Workbook
Dim ActiveWB As Workbook

Set MatrixWB = Application.Workbooks("AssemblyMatrix.xls")
Set ActiveWB = Application.ActiveWorkbook
'Error when trying to check each cell in the Active sheet?
For Each oRange In ActiveWB.ActiveSheet

If Not oRange.Value = "" Then
With MatrixWB.Sheets("Sheet1")
.Cells(oRange.Row, oRange.Column).Value = _
oRange.Value
End With
End If

Next oRange




Soli3d

Copy cell data Workbook to Workbook
 
Perfect...Thanks

"Tom Ogilvy" wrote:

For Each oRange In ActiveWB.ActiveSheet.UsedRange

--
Regards,
Tom Ogilvy

"Soli3d" wrote in message
...
Hello,

I am trying to copy the contents of the
active sheet in the active workbook to
sheet1 of a second named workbook.

I get an error when starting loop to
check each cell[range] in the Active
Sheet.

What am I doing wrong? Much Thanks...

Paul


Dim oRange As Range

Dim MatrixWB As Workbook
Dim ActiveWB As Workbook

Set MatrixWB = Application.Workbooks("AssemblyMatrix.xls")
Set ActiveWB = Application.ActiveWorkbook
'Error when trying to check each cell in the Active sheet?
For Each oRange In ActiveWB.ActiveSheet

If Not oRange.Value = "" Then
With MatrixWB.Sheets("Sheet1")
.Cells(oRange.Row, oRange.Column).Value = _
oRange.Value
End With
End If

Next oRange






All times are GMT +1. The time now is 05:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com