Consulting

Results 1 to 12 of 12

Thread: Vba process entire row delete

  1. #1

    Vba process entire row delete

    check wheather column C has data if yes then do nothing if no then delete that entire row by vba
    file name sonu.csv file is located in C:\Users\soniya\Desktop
    i will put a macro in different file and both files are located in same place
    save it after the process completed and close it

  2. #2

  3. #3
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    You will have to be more clear. If no data in column F, delete all rows? That means clear the whole worksheet.

  4. #4
    If cells in column F has no data then delete that entire row only
    Example
    If F15 is blank then delete that entire row only and look for next if found then delete and so on.....
    Thnx Kenneth Hobs Sir for showing interest in this post
    If u have more doubts then plz ask

  5. #5
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,055
    Location
    @imrankhan. Your request to have this thread deleted is going to be declined. Just because it has been noted that you have posted the issue elsewhere and failed to notify either forum of “cross posting” does not justify removing the thread.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  6. #6
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    Sub DelFBlanks()    
        On Error Resume Next
        Columns("F").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
    End Sub

  7. #7
    Sub Mysub() 
    Dim wbk1 As Workbook
    Dim wsh1 As Worksheet
    Application.ScreenUpdating = False
    Set wbk1 = Workbooks.Open(ThisWorkbook.Path & "\123..csv")
    Set wsh1 = wbk1.Worksheets(1)
    With wsh1
    On Error Resume Next
    Columns("F").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
    End If
    Application.DisplayAlerts = False 
    wkb1.Close SaveChanges:=True
     Application.DisplayAlerts = True
     Application.ScreenUpdating = True
    End Sub
    Ur code is working Sir but as i said i wil put the macro in different file so i made this code and this code contains error so plz have a look Sir and help

  8. #8
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    How does that run?

    wsh1.Columns("F").SpecialCells(xlCellTypeBlanks).EntireRow.Delete

  9. #9
    Sub Mysub()    Dim wbk1 As Workbook
       Dim wsh1 As Worksheet
     
       Application.ScreenUpdating = False
     
       Set wbk1 = Workbooks.Open(ThisWorkbook.Path & "\123..csv")
       Set wsh1 = wbk1.Worksheets(1)
     
       With wsh1
       On Error Resume Next
       wsh1.Columns("F").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
       
    End If
    
    
    
    
    
    
    
    
       Application.DisplayAlerts = False
       wbk1.Close SaveChanges:=True
       Application.DisplayAlerts = True
     
       Application.ScreenUpdating = True
     
    End Sub
    after changing the same then also code is not working Sir

  10. #10
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    It will not run because it will not compile. Even a Run will usually tell you what and where the problem is as does Debug menu's Compile. Try to use Compile before a Run.

    Why use With when you added the sheet object? It serves no purpose. Either delete it or add End With. With is best used when you have multiple object calls.

  11. #11
    Thnx Alot Kenneth Hobs Sir for giving ur Precious Time and Great Support to this Post
    Have a Great Day Sir

  12. #12
    Sorry Aussiebear Thnx for not deleting this post
    Thnx for the help Sir

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •