1
我在將此代碼的結果顯示到Sheet2時遇到問題。有沒有辦法將此代碼轉換爲使其顯示在特定的工作表中?比如說Sheet2?將結果顯示在另一個工作表中
cell.Offset(,.Columns.Count + 1)= rowOffset
這裏是整個代碼:
Option Explicit
Sub main()
Dim cell As Range, f As Range
Dim rowOffset As Long
With Worksheets("gaps").Range("A2:F2000")
For Each cell In .SpecialCells(xlCellTypeConstants, xlNumbers)
rowOffset = 1
Set f = .Find(what:=cell, after:=cell, LookIn:=xlValues, lookat:=xlWhole, searchdirection:=xlPrevious)
If Not f Is Nothing And f.Row <= cell.Row Then rowOffset = cell.Row - f.Row + 1
cell.Offset(, .Columns.Count + 1) = rowOffset '<--| Modify this code to have it displayed in a specific worksheet
Next cell
End With
End Sub
你釘它布魯!非常感謝你!! –