Avinash Singh
asked on
delete the last cell data of each row of multiple sheet
Nothing to do with sheet1
delete the last cell data of each row of Sheet2
delete the last cell data of each row of Sheet3
delete the last cell data of each row of Sheet4
see the Result , I want the result in same sheet not in separate sheet
I have to do all this by Vba
Kindly see the sample file
Book1.xlsm
delete the last cell data of each row of Sheet2
delete the last cell data of each row of Sheet3
delete the last cell data of each row of Sheet4
see the Result , I want the result in same sheet not in separate sheet
I have to do all this by Vba
Kindly see the sample file
Book1.xlsm
ASKER
This code deletes the last cell data of each row of all sheets and i want to delete the last cell data of each row of sheet2,sheet3,sheet4 only
Try this
Option Explicit
Sub DeleteLastCll()
Dim oWs As Worksheet
Dim lRw As Long
Dim iX As Integer
For Each oWs In ThisWorkbook.Worksheets
If oWs.Name <> "Sheet1" Then
For iX = 1 To oWs.Range("A1").CurrentRegion.Rows.Count
oWs.Cells(iX, oWs.Columns.Count).End(xlToLeft).Delete
Next iX
End If
Next oWs
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thnx Shums Sir, Thnx Roy Cox Sir for giving ur precious time and great support to this post
Shums Sir Actually i have more sheets thats why previous code was deleteing that sheets data also but now this code is perfect, accurate and Thnx once again for the same Sir
Shums Sir Actually i have more sheets thats why previous code was deleteing that sheets data also but now this code is perfect, accurate and Thnx once again for the same Sir
You're Welcome Avinash! Glad I was able to help you.
Try below:
Open in new window
AvinashSingh_ClearLastCell.xlsm