Results 1 to 14 of 14

Delete specific range cell data based on user input

Threaded View

terriertrip Delete specific range cell... 07-06-2017, 02:29 PM
xladept Re: Delete specific range... 07-06-2017, 02:55 PM
terriertrip Re: Delete specific range... 07-06-2017, 04:05 PM
xladept Re: Delete specific range... 07-06-2017, 04:34 PM
terriertrip Re: Delete specific range... 07-06-2017, 04:52 PM
xladept Re: Delete specific range... 07-06-2017, 04:56 PM
terriertrip Re: Delete specific range... 07-06-2017, 05:05 PM
xladept Re: Delete specific range... 07-06-2017, 05:22 PM
terriertrip Re: Delete specific range... 07-06-2017, 05:28 PM
xladept Re: Delete specific range... 07-06-2017, 06:55 PM
xladept Re: Delete specific range... 07-06-2017, 06:12 PM
terriertrip Re: Delete specific range... 07-06-2017, 06:34 PM
xladept Re: Delete specific range... 07-06-2017, 07:57 PM
terriertrip Re: Delete specific range... 07-06-2017, 07:30 PM
  1. #1
    Forum Contributor
    Join Date
    02-25-2013
    Location
    Colorado, US
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    518

    Delete specific range cell data based on user input

    Currently I have a sub that deletes entire row. I just need to delete the range data in A:C (or A:E perhaps based on future processes). What would be the correct way to write the delete code? Code is below:
    Private Sub cmdDelete_Click()
        
        Dim Rw As Long
        
        ' Deletes items and values based on user defined selection through controls
        ' if deletion is made within middle of range, data is moved up
        Rw = Me.ListBox1.ListIndex + 2
        If Me.ListBox1.Text = "" Then
            ElseIf MsgBox("You are about to delete " & txtFm.Text & _
            " from the georeport! Any depths for geoprog and wellsite formation tables will be lost. If you need to update the top, click No and select Update.  Do you wish to continue?", _
            vbYesNo + vbDefaultButton2, "Delete Formation") = vbNo Then
            Exit Sub
        End If
        If Me.ListBox1.ListIndex > -1 Then Sheets(msSHEET_NAME).Cells(Rw, 1).EntireRow.Delete
            With ThisWorkbook.Sheets(msSHEET_NAME)
                txtFm.Text = ""
                txtMD.Text = ""
                txtTVD.Text = ""
        End With
        FillListBox
    End Sub
    Last edited by terriertrip; 07-06-2017 at 07:59 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [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
  2. [SOLVED] Average range of data based on user input
    By acopp24 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-05-2016, 01:07 PM
  3. [SOLVED] Macro to find user input date range and delete everything outside range
    By sudric in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-13-2015, 11:52 AM
  4. Replies: 0
    Last Post: 12-10-2014, 11:30 AM
  5. [SOLVED] Copy paste specific row of data based on user input
    By jjsiow in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-23-2014, 11:59 AM
  6. Macro to input data on specific cell based on range of another cell data
    By tatisif in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-03-2013, 12:06 PM
  7. Can name range display value based on the input of specific cell?
    By rusoo7 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-24-2010, 11:17 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