Sub tcptiff()
Dim TCP As String
Dim eebo As String
Dim tiff As String
Dim facpage As String
On Error GoTo Errorcatch
TCP = Range("F1").Value
tiff = Range("F2").Value
eebo = ActiveCell(0, 0).Value
facpage = ActiveCell(, 3).Value
If IsEmpty(Range(ActiveCell(, 3))) = False Then
If Len(eebo) = 2 Then
ActiveCell(, 1).Value = TCP & "-" & "00" & Left(eebo, 1) & "-" & Right(eebo, 1)
ActiveCell(, 2).Value = tiff & "_Page_" & facpage
ElseIf Len(eebo) = 3 Then
ActiveCell(, 1).Value = TCP & "-" & "0" & Left(eebo, 2) & "-" & Right(eebo, 1)
ActiveCell(, 2).Value = tiff & "_Page_" & facpage
End If
End If
Errorcatch:
MsgBox Err.Description
End Sub
我试图编写一个excel宏,以便用相邻单元格的相关信息填充两列。我在Sheet2 Code中编写了宏。我一直在接受Method' Range'对象' _Worksheet'失败。问题是什么?我试图指定工作表,但这并不能解决问题。
答案 0 :(得分:0)
问题在于:
If IsEmpty(Range(ActiveCell(, 3))) = False Then
ActiveCell(,3)已经是一个范围所以:
If IsEmpty(ActiveCell(, 3)) = False Then