+ Reply to Thread
Results 1 to 3 of 3

Amend code

  1. #1
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

    Amend code

    Looking to see if range contains a entry then clear the area called Clear

    Any ideas greatfully received
    Sub Macro7()

    If Range("Clear_Area").Value <> "-" Then
    Range("Clear").ClearContents
    End If
    End Sub

    VBA noob

  2. #2
    Valued Forum Contributor
    Join Date
    12-16-2004
    Location
    Canada, Quebec
    Posts
    363
    Hi VBA

    Would this help

    Sub keepdash()
    Dim Cell As Range
    Dim R As Range
    Set R = ActiveSheet.UsedRange
    'SearchChar = "-"
    For Each Cell In R
    valeur = Cell.Value
    MyPos = InStr(1, valeur, "-")
    If MyPos = 0 Then
    Cell.Clear
    End If
    Next
    End Sub

  3. #3
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Tried it on sheet and clear a lot of my data.

    Must be a easier way to select A5 to L9 to check if there is text apart from "-" which are in A5 to A9

    Thanks in advance

    VBA noob

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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