Results 1 to 5 of 5

Thread: Delete Entire Row For All Empty Cells In Column

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    May 2013
    Posts
    6
    Rep Power
    0
    Quote Originally Posted by patel View Post
    your code works well on my test workbook (excel 2010), also with not blank cells
    maybe my code put wrong line ....

    Code:
        Private Sub buttonnew_Click()
        Dim Cancel As Boolean
        Dim keyCol As Range
        Dim i As Long
        Set keyCol = ThisWorkbook.Sheets("Data").Columns(2)
    
        
        If Me.noinvoice.Value = "" Then
        MsgBox "Please enter a name", vbExclamation, "Invoice"
        Cancel = True
        End If
        If Me.Tanggal.Value = "" Then
        MsgBox "Please enter a item", vbExclamation, "Invoice"
        Cancel = True
        End If
        If Me.Costumers1.Value = "" Then
        MsgBox "Please enter a costumers name", vbExclamation, "Invoice"
        Cancel = True
        End If
        If Me.ttd.Value = "" Then
        MsgBox "Please enter a ttd", vbExclamation, "Invoice"
        Cancel = True
        End If
        If Me.initial.Value = "" Then
        MsgBox "Please enter a initial", vbExclamation, "Invoice"
        Cancel = True
        End If
        
        If Cancel = True Then
            'Do nothing
        Else
    
        For i = 1 To 10
        If Me.Controls("item" & i).Text <> vbNullString Then
        With keyCol.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).EntireRow
         .Columns("L").Value = Me.Controls("item" & i).Text
         .Columns("N").Value = Me.Controls("unit" & i).Value
         .Columns("K").Value = Me.Controls("type" & i).Text
         .Columns("M").Value = Me.Controls("harga" & i).Value
         .Columns("P").Value = disc1
         .Columns("Y").Value = Me.PajakCode.Value
         .Columns("S") = "10%"
         .Columns("B") = noinvoice
         .Columns("C").Value = Me.Tanggal.Value
         .Columns("D").Value = Costumers1
         .Columns("V").Value = Note
         .Columns("X").Value = ttd
         .Columns("W").Value = initial
         End With
         End If
         Next i
            
            Range("AA1").Select
            ActiveWindow.ScrollColumn = 1
            ActiveWindow.ScrollRow = 1
                Unload Me
         End If
    
                Worksheets("Data").Columns("M").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
    
           End Sub
    and can i'm input two columns M & N ? i'm noobs VBA must using columns("M:N") or columns("M"),columns("N) or other suggest.

    Thanks - John
    Attached Files Attached Files
    Last edited by johnreid7477; 06-13-2013 at 08:49 PM.

Similar Threads

  1. Delte a specific column and does not delete the top row
    By jffryjsphbyn in forum Excel Help
    Replies: 1
    Last Post: 06-13-2013, 02:00 PM
  2. Replies: 13
    Last Post: 06-10-2013, 09:05 AM
  3. Replies: 3
    Last Post: 05-23-2013, 11:17 PM
  4. Replies: 2
    Last Post: 09-24-2012, 11:19 PM
  5. Delete Empty Rows
    By Rasm in forum Excel Help
    Replies: 4
    Last Post: 04-28-2011, 02:13 AM

Posting Permissions

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