When I run the Macro it deletes all the data here is my data
It was working last week but this time it is deleting everything but the first two lines?
Am using this code:
Sub combineRows()
Dim ws As Worksheet, r As Long, lr As Long, cell As Range
Set ws = ActiveSheet
lr = ws.Cells(ws.Rows.Count, "B").End(xlUp).Row
Application.ScreenUpdating = False
For r = lr To 3 Step -1
Set cell = ws.Cells(r, "A")
If cell = "" Then
cell.Offset(-1, 2) = cell.Offset(, 1)
cell.EntireRow.Delete
End If
Next r
End Sub
It was working last week but this time it is deleting everything but the first two lines?
Am using this code:
Sub combineRows()
Dim ws As Worksheet, r As Long, lr As Long, cell As Range
Set ws = ActiveSheet
lr = ws.Cells(ws.Rows.Count, "B").End(xlUp).Row
Application.ScreenUpdating = False
For r = lr To 3 Step -1
Set cell = ws.Cells(r, "A")
If cell = "" Then
cell.Offset(-1, 2) = cell.Offset(, 1)
cell.EntireRow.Delete
End If
Next r
End Sub
Sheet1 | ||
---|---|---|
A | B | |
Incidents Project - Jobs Converted-k.xlsm | ||
1 | EDIBCBD9 | |
2 | 228 //BADRC EXEC EDIP0022,JOBNAME=EDIBCBD9, | |
3 | EDIBCBM9 | |
4 | 316 //BADRC EXEC EDIP0022,JOBNAME=EDIBCBM9, | |
5 | EDIBCBW9 | |
6 | 316 //BADRC EXEC EDIP0022,JOBNAME=EDIBCBW9, | |
7 | EDIBCBY9 | |
8 | 315 //BADRC EXEC EDIP0022,JOBNAME=EDIBCBY9, | |
9 | EDIBC601 | |
10 | 83 //BADRC EXEC EDIP0022,JOBNAME=EDIBC601, | |
11 | EDIBC604 | |
12 | 959 //BADRC EXEC EDIP0022,JOBNAME=EDIBC604, | |
13 | EDIBC605 | |
14 | 64 //BADRC EXEC EDIP0022,JOBNAME=EDIBC605, | |
15 | EDIBC606 | |
16 | 145 //BADRC EXEC EDIP0022,JOBNAME=EDIBC606, | |
17 | EDIBC607 | |
18 | 103 //BADRC EXEC EDIP0022,JOBNAME=EDIBC607, | |
19 | EDIBC608 | |
20 | 357 //BADRC EXEC EDIP0022,JOBNAME=EDIBC608, | |
21 | EDIBC609 | |
22 | 42 //BADRC EXEC EDIP0022,JOBNAME=EDIBC609, | |
23 | EDIBC611 | |
24 | 58 //BADRC EXEC EDIP0022,JOBNAME=EDIBC611, |
Cell | Condition | Cell Format | Stop If True | |
---|---|---|---|---|
Cells with Conditional Formatting | ||||
A:A | Cell Value | ="N" | text | NO |
A:A | Cell Value | ="Y" | text | NO |