problem code works in worksheet selection event but not in change event

abdelfattah

Well-known Member
Joined
May 3, 2019
Messages
1,429
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
hello

i have this code works in selection event but not in change event and if is possible amending the code or getting alternative the code select cells or change depend on range ("d11:m22") and show in j23 so i want only this range applies when cell is actived not out side this range
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$j$23" Then
Target.Value = ""
Else
[j23].MergeArea = ActiveCell
End If
End Sub


my data
active cell.xlsm
DEFGHIJKLM
1112345678910
1211121314151617181920
1321222324252627282930
1431323334353637383940
1541424344454647484950
16140148181182183184185186187188
17189190191192193194195196197198
18199200201202203204205206207208
19209210211212213214215216217218
20219220221222223224225226222228
21229230
22numbers
23
sheet1
 
unfortunately not successfully when i select cells g23 this is out range (d11:m22) it supposes clear in j23 but it shows text "number" as fill in g23
 
Upvote 0

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
yes, you right i can't explain more than for this and it seems i failed reaching my idea to understand what i want overall your codes are very well and the small part is not matter just improve working the code i appreciate your patience and time



best regards,

abdelfattah
 
Upvote 0

Forum statistics

Threads
1,214,798
Messages
6,121,636
Members
449,043
Latest member
farhansadik

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