Home > Software engineering >  This code is wrong
This code is wrong

Time:11-19

Sin. The Range (Cells (I, 4), Cells (j, 4)). Copy ThisWorkbook. Sheets (" 35 "). The Range (" C3 ")
Sin is another workbook a worksheet, thinking of the scope of the range of sin to the current workbook a worksheet, always unsuccessful
Mistake is not to say that the application, and is the property value
Complete below

Option Explicit

Sub demo ()

The Debug. Print Range (" A1 "). The End (xlDown). Row

Dim the ws As Workbook, sin As Worksheet, I As an Integer, j As an Integer, k As an Integer, gol As Worksheet

K=1

Set the ws=Workbooks. Open (Filename:="E: \ case vba \ \ data problem. XLS")
The Set gol=ThisWorkbook. Worksheets (" 35 ")


For Each sin In ws. Sheets

I=sin. Range (" D1 "). The End (xlDown). Row
J=sin Range (" D65536 "). The End (xlUp). Row



Sin. The Range (Cells (I, 4), Cells (j, 4)). Copy ThisWorkbook. Sheets (" 35 "). The Range (" C3 ")



K=k + 1

Next sin
End Sub


CodePudding user response:

To make the "sin. Range (Cells (I, 4), Cells (j, 4)). Copy ThisWorkbook. Sheets (" 35"). The Range (" C3 ") "the change on
Modified to
Sin. The Range (sin. Cells (I, 4), sin. The Cells (j, 4)). Copy ThisWorkbook. Sheets (" 35 "). The Range (" C3 ")

Should be passed
  •  Tags:  
  • VBA
  • Related