M
ML0940
Hi,
With some help from user OssieMac,
I was able to get the code to this point, but I think I may need some help
to get to the next step.
For the sake of this test, I have two named ranges on one worksheet:
Range("Sh1BWTest") and Range("Sh2BWTest")
When I insert a row into Range("Sh1BWTest"),
I need the row range in Range("Sh2BWTest") to also adjust and update..
The code is almost there, I just can not get that last part.
Any help would be appreciated.
Thank you
ML
Private Sub Worksheet_Change(ByVal Target As Range) '*** This part works well
Dim isect As Object
Set isect = Intersect(Target, Range("Sh1BWTest"))
If Not isect Is Nothing Then
Application.EnableEvents = False
'Clear data from Sh2bWTest in case the Sh1BWTest range is smaller
Range("Sh2BWTest").ClearContents
MsgBox "Cleared" 'Confirm the clear was sucessful
Range("Sh2BWTest").Value = Range("Sh1BWTest").Value
'Select and rename range
Range("Sh2BWTest").Select
ActiveWorkbook.Names.Add Name:="Sh2BWTest", _
RefersToR1C1:=Selection
End If
Application.EnableEvents = True
'Range("A1").Activate
End Sub
With some help from user OssieMac,
I was able to get the code to this point, but I think I may need some help
to get to the next step.
For the sake of this test, I have two named ranges on one worksheet:
Range("Sh1BWTest") and Range("Sh2BWTest")
When I insert a row into Range("Sh1BWTest"),
I need the row range in Range("Sh2BWTest") to also adjust and update..
The code is almost there, I just can not get that last part.
Any help would be appreciated.
Thank you
ML
Private Sub Worksheet_Change(ByVal Target As Range) '*** This part works well
Dim isect As Object
Set isect = Intersect(Target, Range("Sh1BWTest"))
If Not isect Is Nothing Then
Application.EnableEvents = False
'Clear data from Sh2bWTest in case the Sh1BWTest range is smaller
Range("Sh2BWTest").ClearContents
MsgBox "Cleared" 'Confirm the clear was sucessful
Range("Sh2BWTest").Value = Range("Sh1BWTest").Value
'Select and rename range
Range("Sh2BWTest").Select
ActiveWorkbook.Names.Add Name:="Sh2BWTest", _
RefersToR1C1:=Selection
End If
Application.EnableEvents = True
'Range("A1").Activate
End Sub