Hi guys,
I want to create a macro that will loop through a range and clear a row if the value in the coulm A matches a value in another sheet. Then I want the macro to pick another value from another sheet and do the loop again. And again and again through the same rows but changing the checked value. My code is:
I get and "Next withour For" Error error and I don't know why. I have 2x For and 2x Next. Why isn't it working?
Greetings!
I want to create a macro that will loop through a range and clear a row if the value in the coulm A matches a value in another sheet. Then I want the macro to pick another value from another sheet and do the loop again. And again and again through the same rows but changing the checked value. My code is:
Code:
Sub UsunWiersze()
Dim Var1 As Range
Dim NumerWierszaDekret As Integer
Dim NumerWierszaBaza As Integer
Dim WIersz As Range
Dim VAB As Range
NumerWierszaDekret = 1
Set Var1 = ActiveWorkbook.Worksheets("Dekrety").Range("A" & NumerWierszaDekret)
ActiveWorkbook.Worksheets("Baza").Range("A1").Activate
For NumerWierszaDekret = 1 To 373
Set Var1 = ActiveWorkbook.Worksheets("Dekrety").Range("A" & NumerWierszaDekret)
For Each VAB In Range("A1:A27459")
If VAB.Value = Var1 Then
VAB.EntireRow.Clear
Next VAB
Next NumerWierszaDekret
End Sub
I get and "Next withour For" Error error and I don't know why. I have 2x For and 2x Next. Why isn't it working?
Greetings!