Reputation: 31
I am trying this code
row = 2
With Summary
.Range("$A$1:$A$100").RemoveDuplicates Columns:=1, Header:=xlYes
For row To .Rows.Count
.Cells(row, 2) = 1
row = row + 1
Next row
End With
but I get a syntax error in the for loop statement
How should this look like?
Upvotes: 0
Views: 45
Reputation: 96753
You do not need a Loop
:
Sub dural()
Dim N As Long, summary As Worksheet
Set summary = ActiveSheet
With summary
.Range("$A$1:$A$100").RemoveDuplicates Columns:=1, Header:=xlYes
N = .Cells(Rows.Count, 1).End(xlUp).Row
.Range("B2:B" & N).Value = 1
End With
End Sub
Note: The code assumes there is nothing else in column A.
Upvotes: 1