Hi,
I moved a working macro from one spreadsheet to another andit has now stopped working. In both spreadsheets, the data is in the same rowsand columns, with the exception of there now being one more column (L).
The data starts on row 5, with the headings on row 4. Theamount of rows differs each time I run the macro.
The macro previously found anything in column A with either “Apples”,“Bananas”, or “Plums” and deleted the entire row. Now it leaves the rows in thespreadsheet but throws up no errors.
Another user helped me with the macro, hence I am strugglingto decipher it.
The part of the macro not working is this…
lastrow =Cells(Rows.Count, 1).End(xlUp).Row
v1 =ActiveSheet.Range(Cells(1, 1), Cells(lastrow, 27)).Value2
bUnion = False
For i = 1 Tolastrow
If v1(i, 1) ="Apples" Or v1(i, 1) = "Bananas" Or v1(i, 1) = "Plums"Then
If bUnionThen
Set r1= Union(r1, Cells(i, 1))
Else
Set r1= Cells(i, 1)
bUnion= True
End If
End If
Next i
Thanks,
Rich
I moved a working macro from one spreadsheet to another andit has now stopped working. In both spreadsheets, the data is in the same rowsand columns, with the exception of there now being one more column (L).
The data starts on row 5, with the headings on row 4. Theamount of rows differs each time I run the macro.
The macro previously found anything in column A with either “Apples”,“Bananas”, or “Plums” and deleted the entire row. Now it leaves the rows in thespreadsheet but throws up no errors.
Another user helped me with the macro, hence I am strugglingto decipher it.
The part of the macro not working is this…
lastrow =Cells(Rows.Count, 1).End(xlUp).Row
v1 =ActiveSheet.Range(Cells(1, 1), Cells(lastrow, 27)).Value2
bUnion = False
For i = 1 Tolastrow
If v1(i, 1) ="Apples" Or v1(i, 1) = "Bananas" Or v1(i, 1) = "Plums"Then
If bUnionThen
Set r1= Union(r1, Cells(i, 1))
Else
Set r1= Cells(i, 1)
bUnion= True
End If
End If
Next i
Thanks,
Rich