Blank rows deletion
Closed
Aslam
-
Oct 23, 2011 at 04:42 PM
aquarelle Posts 7140 Registration date Saturday April 7, 2007 Status Moderator Last seen March 25, 2024 - Nov 16, 2011 at 12:19 AM
aquarelle Posts 7140 Registration date Saturday April 7, 2007 Status Moderator Last seen March 25, 2024 - Nov 16, 2011 at 12:19 AM
Related:
- Blank rows deletion
- An example of a cell is a blank cell ✓ - Programming Forum
- Whatsapp account deletion page - Guide
- How to delete rows and columns in word - Guide
- Blank photo facebook ✓ - Facebook Forum
- Blank white square ✓ - Monitor Forum
6 responses
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Oct 23, 2011 at 10:46 PM
Oct 23, 2011 at 10:46 PM
copy the data in sheet 1 in some other location e.g. sheet 2 also as precaution
now try this macro on sheet1
now try this macro on sheet1
Sub test() Dim r As Range, j As Long, r1 As Range j = Cells(Rows.Count, "A").End(xlUp).Row Set r = Cells(j, 1) Do Set r1 = r.End(xlUp) Range(r.End(xlUp).Offset(-1, 0), r1.End(xlUp).Offset(2, 0)).EntireRow.Delete Set r = r1.End(xlUp) If r.Row = Range("A1").End(xlDown).Row Then Exit Do Loop End Sub
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Oct 24, 2011 at 03:13 AM
Oct 24, 2011 at 03:13 AM
quote
ust need one amendment in this, that the macro will work only on sheet1 of workbook "Records" not on all open workbooks.
unquote
First save the workbook safely some where to recover if something goes wrong.
see this macro
ust need one amendment in this, that the macro will work only on sheet1 of workbook "Records" not on all open workbooks.
unquote
First save the workbook safely some where to recover if something goes wrong.
see this macro
Sub test() Dim r As Range, j As Long, r1 As Range, k As Long For k = 1 To Worksheets.Count With Worksheets(k) j = .Cells(Rows.Count, "A").End(xlUp).Row Set r = .Cells(j, 1) Do Set r1 = r.End(xlUp) Range(r.End(xlUp).Offset(-1, 0), r1.End(xlUp).Offset(2, 0)).EntireRow.Delete Set r = r1.End(xlUp) If r.Row = .Range("A1").End(xlDown).Row Then Exit Do Loop End With Next k End Sub
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Oct 25, 2011 at 08:50 PM
Oct 25, 2011 at 08:50 PM
can you please post a very small extract of atleast 2 data sheets
aquarelle
Posts
7140
Registration date
Saturday April 7, 2007
Status
Moderator
Last seen
March 25, 2024
491
Oct 28, 2011 at 01:55 PM
Oct 28, 2011 at 01:55 PM
Hi,
To send an extracted sheets you can upload your file on https://authentification.site and copy/paste the created link into your next message.
Regards
To send an extracted sheets you can upload your file on https://authentification.site and copy/paste the created link into your next message.
Regards
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Oct 29, 2011 at 03:16 AM
Oct 29, 2011 at 03:16 AM
take aquarelle'S suggestion
Didn't find the answer you are looking for?
Ask a question
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Nov 11, 2011 at 10:44 PM
Nov 11, 2011 at 10:44 PM
thank you for uploading the two files. in your first message you talk about worksheet named "records". there is no such sheet in either of your two files
I suggest re frame your questions with respect to these two files.
I suggest re frame your questions with respect to these two files.
Dear Venkat1926,
I need one blank row after record of each month rest should be deleted, for this purpose I am using following macro but its not working properly:
Public Sub DeleteRow()
' DeleteRow Macro
'
' Keyboard Shortcut: Ctrl+j
Dim x As Long
Dim y As Long
x = Range("C65536").End(xlUp).Row
For y = x To 2 Step -1
If Cells(y, 2).Value = "" And Cells(y, 3).Value = "" And Cells(y, 4).Value = "" Then
Rows(y).Delete
End If
Next y
End Sub
kindly check it and amend it where its needed.
just keep one row blank row after records of each month to make it seperate, rest blank rows should be deleted through macro. The macro should work till last row of the worksheet.
Thank you,
Aslam
I need one blank row after record of each month rest should be deleted, for this purpose I am using following macro but its not working properly:
Public Sub DeleteRow()
' DeleteRow Macro
'
' Keyboard Shortcut: Ctrl+j
Dim x As Long
Dim y As Long
x = Range("C65536").End(xlUp).Row
For y = x To 2 Step -1
If Cells(y, 2).Value = "" And Cells(y, 3).Value = "" And Cells(y, 4).Value = "" Then
Rows(y).Delete
End If
Next y
End Sub
kindly check it and amend it where its needed.
just keep one row blank row after records of each month to make it seperate, rest blank rows should be deleted through macro. The macro should work till last row of the worksheet.
Thank you,
Aslam
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Nov 15, 2011 at 08:35 PM
Nov 15, 2011 at 08:35 PM
Aslam there appears to be a SPAM reply. inform administrator
however your request
"just keep one row blank row after records of each month to make it seperate, rest blank rows should be deleted through macro. The macro should work till last row of the worksheet. "
try this macro
however your request
"just keep one row blank row after records of each month to make it seperate, rest blank rows should be deleted through macro. The macro should work till last row of the worksheet. "
try this macro
Public Sub DeleteRow() ' DeleteRow Macro ' ' Keyboard Shortcut: Ctrl+j Dim x As Long Dim y As Long x = Range("C65536").End(xlUp).Row For y = x To 2 Step -1 If Cells(y, 2).Value = "" And Cells(y, 3).Value = "" And Cells(y, 4).Value = "" Then Rows(y).Delete End If Next y For y = 2 To x If Cells(y, "B") <> "" Then Rows(y + 1).Insert Next y End Sub
aquarelle
Posts
7140
Registration date
Saturday April 7, 2007
Status
Moderator
Last seen
March 25, 2024
491
Nov 16, 2011 at 12:19 AM
Nov 16, 2011 at 12:19 AM
Hi,
Aslam there appears to be a SPAM reply. inform administrator
The spam message has been deleted.
Thus when you see a spam message or a message out of charter, use the "Report" link near the message to indicate it to us.
Thanks by advance :)
Aslam there appears to be a SPAM reply. inform administrator
The spam message has been deleted.
Thus when you see a spam message or a message out of charter, use the "Report" link near the message to indicate it to us.
Thanks by advance :)
Oct 24, 2011 at 01:06 AM
Thank you very much for the solving this problem. The macro you have write its working. Just need one amendment in this, that the macro will work only on sheet1 of workbook "Records" not on all open workbooks.
Oct 24, 2011 at 01:27 AM
When I run this macro first time I just noticed that one blank line is there between record of each months data and all other blank lines deleted. but after it I noticed that its deleting last row of the months which contain data. please check it and make sure that it will not delete any row which contain data.
Thank you
Oct 24, 2011 at 02:15 AM
I am very sorry that I have write above message to you in hustle. Actually the macro is deleting first two rows only all other working is good.