ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selection change: additional question (https://www.excelbanter.com/excel-programming/293146-selection-change-additional-question.html)

Maria[_6_]

Selection change: additional question
 
Hello:
I would appreciate help with this one: (in addition to my other similar
question earlier)

Users change value in cell A1.
As soon as value of A1 is changed I would like to delete the values in cells
B1:B3. What kind of code would I need to do this?

TIA

--
Maria .



Frank Kabel

Selection change: additional question
 
Hi Maria
see your other post and change the code to:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("A1")) Is Nothing Then Exit Sub
On Error GoTo CleanUp:
With Target
if .value = "" then
cells(1,2).value = ""
cells(2,2).value = ""
cells(3,2).value = ""
else
Select Case .Value
Case 1 'change this according to your needs
cells(1,2).value = "value1-1"
cells(2,2).value = "value1-2"
cells(3,2).value = "value1-3"
Case 2
cells(1,2).value = "value2-1"
cells(2,2).value = "value2-2"
cells(3,2).value = "value2-3"
Case 3
cells(1,2).value = "value3-1"
cells(2,2).value = "value3-2"
cells(3,2).value = "value3-3"
End Select
end if
End With
CleanUp:
Application.EnableEvents = True
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany

Maria wrote:
Hello:
I would appreciate help with this one: (in addition to my other
similar question earlier)

Users change value in cell A1.
As soon as value of A1 is changed I would like to delete the values
in cells B1:B3. What kind of code would I need to do this?

TIA



All times are GMT +1. The time now is 02:28 PM.

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