Home > Software engineering >  Help: VBA error 91: the object variable or variables with block statement, a great god, please help
Help: VBA error 91: the object variable or variables with block statement, a great god, please help

Time:01-14

Each great spirit:
I want to send a excel file with multiple worksheets 1 data assignment to another excel file 2 worksheets (1), but always error, can't find the reason,
Ask god to help me see,

 
Dim As Integer k
Dim m As Integer
Dim n As Integer
Dim w As Integer


12:
MsgBox "please select a file 1
"Filename1=Application. GetOpenFilename (" Excel File, *. XLSX, Excel File, *. XLS ",, "File")
MsgBox "choose file 2
"Filename2=Application. GetOpenFilename (" Excel File, *. XLSX, Excel File, *. XLS ",, "File")
If Filename1="" Or Filename2=" "Then
GoTo 12
The Else
The Set wk1=Workbooks. Open (Filename1)
The Set wk2=Workbooks. Open (Filename2)

N=wk2. Sheets (1). The Columns (1). The Find (" * ", searchdirection:=xlPrevious). Row

For I=1 To n
W=wk2. Worksheets. Count
For k=1 To w
Sh1=wk1. Worksheets (k)
M=sh1 Rows (6). The Find (" * ", searchdirection:=xlPrevious). The Column 'debug at this point, an error,
For j=1 To m
If wk2. Sh2. Cells (I, 1)=Left (sh1. Cells (6, j + 2), 4) Then
Wk2. Sh2. Cells (I, 2)=sh1. Cells (27, j + 3)
Wk2. Sh2. Cells (I, 3)=sh1. Cells (28, j + 3)
The Exit For
End the If
Next
Next
Next
End the If

Wk1. Save
Wk2. Save
Wk1. Close
Wk2. Close

End Sub



  •  Tags:  
  • VBA
  • Related