VB: Sub ClearEmpty() Dim wb As Workbook Dim ws As Worksheet Dim rng As Range Set wb = Application.Workbooks(1) Set ws = wb.Sheets(1) Set rng = Range("K4", "HI4") For Each cell In rng.Cells If Application.WorksheetFunction.IsBlank(cell.Value) And Application.WorksheetFunction.IsText(cell.Value) Then Cell.ClearContents End If Next cell End Sub If you like these VB formatting tags please consider sponsoring the author in support of injured Royal MarinesHowever, when I run this macro, I got an error message:
VB: Run-time Error 438, Object doesn 't support this property or method. If you like these VB formatting tags please consider sponsoring the author in support of injured Royal MarinesDoes anyone konw what went wrong with my codes? Thanks.
Private Sub Worksheet_SelectionChange(ByVal Target As Range) If ActiveCell.Address <> Target.Address Then Exit Sub If Target.Address = "$B$7" Then If [B6] = "BPS" Then ActiveSheet.Unprotect ("PASSWORD") [B7].Locked = False [B7].ClearContents ActiveSheet.Protect ("PASSWORD") MsgBox "Sorry, this is for ITS only" & vbCrLf & _ "", 64, "Access into cell B7 not allowed." End If End If End SubPls help me ensuring that cell value in B7 is cleared whenever B6 contains BPS...thanks
VB: Private Sub CommandButton24_Click() If ComboBox1.ListIndex = -1 Then MsgBox " Please select a search item to delete" Else If MsgBox("Are you sure you would like to delete this search string?", vbYesNo = vbYes) Then With Me.ComboBox1 .RemoveItem .ListIndex .Value = "" Dim ws As Worksheet Set ws = Worksheets("Sheet2") Dim Rw As Long With Me Rw = Me.ComboBox1.ListIndex + 5 ws.Cells(Rw, 2).Clear ws.Cells(Rw, 1).Clear End With End With End If End If End Sub If you like these VB formatting tags please consider sponsoring the author in support of injured Royal MarinesAny help would be appreciated.
VB: Dim c As Range For Each c In ActiveSheet.UsedRange If c.Interior.ColorIndex = xlNone Then c.ClearContents Next c If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines