Results 1 to 9 of 9

Clear contents of 2 cells

Threaded View

  1. #1
    Registered User
    Join Date
    01-18-2012
    Location
    Los Angeles USA
    MS-Off Ver
    Excel Office 365
    Posts
    80

    Clear contents of 2 cells

    I am using the following code, and it works fine. It does what it is suppose to, if finds the row that has the value in the form control Act1 and deletes that whole row in the worksheet. Unfortunately, when the row gets deleted other data in other ranges on the worksheet also get deleted, I trying to avoid moving the list I want to delete from to a new sheet. What I would like to do instead of deleting the row is to find the row and clear the contents of the two columns, AF and AG, in the range and then sort the list, this will give me the effect I want, this range is for a dropdown list that I should have put somewhere else to begin with.

    Private Sub cmdDelete_Click()
    'declare the variables
        Dim findvalue As Range
                
        'check for values
        If Act1.Value = ""  Then
            MsgBox "There is no data to delete"
            Exit Sub
        End If
            'looks for Code and delete the row
            Set findvalue = Sheet3.Range("AF:AF").Find(What:=Act1, LookIn:=xlValues)
            findvalue.EntireRow.Delete
          
        'clear the controls
        For XP = 1 To 3
            Me.Controls("Act" & XP).Value = ""
        Next
        
        SortActivity
    End Sub
    Last edited by laguna92651; 03-24-2015 at 01:18 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Clear contents of cells when another cell changes value
    By chrisd79 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-13-2013, 05:22 AM
  2. Clear contents of cells that do not contain specific text, sort cells that do
    By feckless.lout in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-27-2010, 01:41 AM
  3. Clear contents of cells
    By talytech in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-23-2007, 03:08 PM
  4. [SOLVED] clear cells unless contents are in bold
    By John Jones in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-24-2005, 09:05 AM
  5. [SOLVED] Clear Contents - NonBold cells
    By Steve in forum Excel General
    Replies: 3
    Last Post: 02-13-2005, 08:06 PM

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