私はVBAを初めて使用していますので、最初に値がない場合にシートを別のシートにコピーする必要があります。セルのフォーマットは常に同じです。idが最初に他のシートに欠落している場合にのみシートを別のシートにコピー
Sub test()
Dim tohere As Worksheet
Dim fromhere As Worksheet
Dim rngTohere As Range
Dim rngfromHere As Range
Dim rngCelTohere As Range
Dim count As Integer
Dim strArray As Variant
Dim i As Integer
'Set Workbooks
Set tohere = ThisWorkbook.Worksheets("Test")
Set fromhere = ThisWorkbook.Worksheets("Test 2")
'Set Columns
Set rngTohere = tohere.Columns("C") 'this is our column of interest
Set rngfromHere = fromhere.Columns("C")
i = 1 'this is counter to foryou to know which row you need to copy
count = rngfromHere.Cells.Count - WorksheetFunction.CountBlank(rngfromHere)
strArray = rngfromHere(Cells(1, 1), Cells(count, 1)).Value
'Loop through each cell in Column C
For Each rngCelTohere In rngTohere.Cells
If IsInArray(rngCelTohere.Value, strArray) = False Then
'here need to put copy entire row into sheet
'use i row to copy into tohere Worksheet
End If
i = i + 1 '
Next rngCelTohere
End Sub
Function IsInArray(stringToBeFound As Integer, arr As Variant) As Boolean 'this functions returns true or false. for our case we need it to be false
IsInArray = (UBound(Filter(arr, stringToBeFound)) > -1)
End Function
は誰も私を助けて、これは良いアイデアであれば言って、また、シートの最後にコピー行全体で私を助けることができます:今のところ私はこのコードを持っています。前もって感謝します!あなたのコードは、このためにコンパイルされません
私はそれを変更し、自分のコードをコンパイルしようとします。答えをありがとう、しかし、私はループの私のコードでi番目の行をコピーするための部分がまだ欠けています。私はVBAを使用していないので、このアイデアを試してみてください。今私はそれを必要としています。これを行う簡単な方法があるかどうかはわかりません。 – Chavez
@Chavez - 編集を参照してください。 – Vityata
ありがとうたくさんの男!あなたはロック! – Chavez