+ Reply to Thread
Results 1 to 11 of 11

Delete specific number of rows for each column with user input

Hybrid View

  1. #1
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,409

    Re: Delete specific number of rows for each column with user input

    .
    See if this does what you are seeking ...

    Option Explicit
    
    Sub findCol()
    Dim col As String, cfind As Range
    Dim LastRow As Range
    Dim rng As Range
    Dim i As Long
        
    col = InputBox("Enter Column Name ...", "Find Column")
    
    Set cfind = Cells.Find(what:=col, lookat:=xlWhole)
    
    cfind.Select
      
    Set rng = Range(ActiveCell, ActiveCell.Offset(50, 0))
        With rng
            ' Loop through all cells of the range
            ' Loop backwards, hence the "Step -1"
            For i = .Rows.Count To 1 Step -1
                If .Item(i) = "" Then
                    ' Since cell is empty, delete the whole row
                    .Item(i).Delete
                End If
            Next i
        End With
    End Sub

    Example workbook attached ...
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Delete rows based on two specific dates using a input box
    By sloshpuppy in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-16-2018, 06:57 AM
  2. [SOLVED] Delete specific range cell data based on user input
    By terriertrip in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 07-06-2017, 07:57 PM
  3. [SOLVED] Delete specific data from (x) new rows added as defined by user through input box
    By Jaysk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-10-2017, 12:41 AM
  4. [SOLVED] Help required - User input for text search and delete remaining rows
    By ssss2005 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-20-2015, 11:06 AM
  5. Using text box input to lookup number and replace based on user input into new column
    By harl3y412 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-28-2011, 03:15 PM
  6. Replies: 1
    Last Post: 10-16-2010, 02:43 PM
  7. Delete rows based on user input
    By Militia in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-10-2009, 06:33 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1