erase on insert

quando

New Member
Joined
Apr 30, 2009
Messages
9
I have a block of cells on a single line. Only 1 cell can have a value across all cells in the block. I wish to be able to insert a new value into an empty cell and automatically erase the former value from a different cell.

Is there a way to do this?

I am using Excel 2003.

Thanks,
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
You are refereing to mutually exclusive cells. Several ways, depending on your needs. Specify the Columns of interest and what you mean by Blocks!!
1) Columns "A:F" ?
2) One Row, Several Rows or Each Row Independent of other Rows?

lenze
 
Upvote 0
Hi, You may or may not mean this !!!:-

Code:
Private [COLOR=navy]Sub[/COLOR] Worksheet_Change(ByVal Target [COLOR=navy]As[/COLOR] Range)
Dim Temp 
Application.EnableEvents = False
    [COLOR=navy]If[/COLOR] Target.Count = 1 [COLOR=navy]Then[/COLOR]
        Temp = Target
        Target.EntireRow.ClearContents
        Target = Temp
    [COLOR=navy]End[/COLOR] If
Application.EnableEvents = True
[COLOR=navy]End[/COLOR] [COLOR=navy]Sub[/COLOR]
Regards Mick
 
Upvote 0
lenze -
Let's say in row 1, A:F is my "block", by which I mean I am restricting my attention to these cells alone. Is there a better term to use?

Thanks,
 
Upvote 0
Like this??
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Intersect(Target, Range("$A$1:$F$1")) Is Nothing Then Exit Sub
Application.EnableEvents = False
myval = Target
Range("$A$1:$F$1").ClearContents
Target = myval
Application.EnableEvents = True
End Sub
If you want it for A:F on all Rows, use something like
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Column > 6 Then Exit Sub
Application.EnableEvents = False
myval = Target
Cells(Target.Row, "A").Resize(1, 6).ClearContents
Target = myval
Application.EnableEvents = True
End Sub

lenze
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,551
Members
449,088
Latest member
davidcom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top