ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automation error??? (https://www.excelbanter.com/excel-programming/313137-automation-error.html)

Zurn[_23_]

Automation error???
 

I'M HAVING DIFICULTIES TO GET DATA FROM ANOTHER WORKBOOK. IN SOURCEBOOK
I HAVE A SHEETS WITH LOTS OF EMPTY ROWS...I WANT TO GET JUST THE DAT
FROM IT, NOT THE EMPTY SPACES TOO


Sub GetFromCOMPER()

Dim sourcebook As Workbook
Dim correctbook As Workbook
Dim Mac As Long


SaveDriveDir = CurDir
insertPath = "C:\"
ChDrive insertPath
ChDir insertPath
FName = Application.GetOpenFilename(filefilter:="Excel File
(*.xls), *.xls", _
MultiSelect:=False)

Application.ScreenUpdating = False
Set correctbook = ThisWorkbook
Set sourcebook = Workbooks.Open(FName)

Dim TelRow As Long
TelRow = 0
For Mac = 1 To 5
sourcebook.Sheets("collect").Cells((5 + (Mac - 1)), 2).Activate
ActiveCell.Offset(0, -1).Cop
correctbook.Sheets("gegevensblad").Cells(6+ TelRow, 1)

While Not IsEmpty(ActiveCell)
ActiveCell.Range("A1:C1").Cop
correctbook.Sheets("gegevensblad").Cells(6 + TelRow, 2)
ActiveCell.Offset(0, 11).Range("A1:F1").Cop
correctbook.Sheets("gegevensblad").Cells(6 + TelRow, 17)
ActiveCell.Offset(1, 0).Activate
TelRow = TelRow + 1
Wend

TelRow = TelRow + 1 'na iedere machinecontrole een rij tussen
Next



ChDrive SaveDriveDir
ChDir SaveDriveDir

Application.ScreenUpdating = True



End Sub

When I run the macro, I get the message Automation error, the cod
stops at the red text in code above.
Any suggestions what my problem is

--
Zur
-----------------------------------------------------------------------
Zurn's Profile: http://www.excelforum.com/member.php...fo&userid=1464
View this thread: http://www.excelforum.com/showthread.php?threadid=26810



All times are GMT +1. The time now is 12:00 AM.

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