-
Solved: Deleting part of a merged cell
How do I only delete a single row within a merged cell in a macro? I need to do this because I have a chart that has some parts merged, and whenever I run my code, the entire chart is deleted instead of only the part I want. [VBA]
Sheets("Sheet2").Select
lastRow = ActiveSheet.UsedRange.Rows(ActiveSheet.UsedRange.Rows.Count).row
For row = 33 To lastRow
If Cells(row, 25) = "1" And Cells(row, 15) = "0" Then
Rows(row & ":" & row).Select
Selection.Delete Shift:=xlUp
row = row - 1
End If
Next row
[/VBA]
Also, if I right click the row number in the Excel and click delete, only that row will be removed. I recorded these actions in a macro, but the macro deletes the entire merged cell... Any ideas?
Thanks!
-
untested, try changing the two lines:
Rows(row & ":" & row).Select
Selection.Delete Shift:=xlUp
to just:
Rows(row).Delete
p45cal
Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.
-
Thanks, that worked perfectly.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules