ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Rookie Issue (https://www.excelbanter.com/excel-programming/356015-vba-rookie-issue.html)

Scott Wagner

VBA Rookie Issue
 
This should be an easy one for the enlightened.

If cell in column E is not blank, clear contents of corresponding cell in
column C.

Otherwise, do nothing.

Thanks for your brains,

Scott

Doug Glancy

VBA Rookie Issue
 
Scott,

I think this will work for you:

With Range("E:E")
'in case no constants or no formulas - either will trigger an error
On Error Resume Next
.SpecialCells(xlCellTypeConstants).Offset(0, -2).ClearContents
.SpecialCells(xlCellTypeFormulas).Offset(0, -2).ClearContents
On Error GoTo 0
End With

hth,

Doug

"Scott Wagner" wrote in message
...
This should be an easy one for the enlightened.

If cell in column E is not blank, clear contents of corresponding cell in
column C.

Otherwise, do nothing.

Thanks for your brains,

Scott




Jim May

VBA Rookie Issue
 
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column < 5 Then
Exit Sub
Else
If Target < "" Then
Target.Offset(0, -2).ClearContents
End If
End If
End Sub

"Scott Wagner" wrote:

This should be an easy one for the enlightened.

If cell in column E is not blank, clear contents of corresponding cell in
column C.

Otherwise, do nothing.

Thanks for your brains,

Scott



All times are GMT +1. The time now is 07:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com