OK, I think I understand now.
In your last post, post #9, you gave basically the same explanation as in your very first post, post #1,
The small difference is that instead of a range A1:E8 we now have a range A25:G27
So you already have the coding for that, you just need to change the ranges appropriately
The coding would take this sort of form….
_____ If Application.Intersect(Target, Me.Range("A26:A27,C26:C27")) Is Nothing Then
‘ code like before with ranges adjusted appropriately
Now I see we basically have 3 extra ranges. In other words, we are really just doing the same thing again another 3 times
I don’t think it is particularly complicated. In basic terms you are doing the same thing again 4 times instead of 1 time.
There is no real new complications:
So you did it once, and can do it again ( and again and again and again !!! )
I suppose writing coding is always a bit tedious.
It is not too bad in your particular requirement because we have a lot of very similar coding. We can do a lot of copying ( Ctrl+c ) and pasting ( Ctrl+v ) . After that you need to make minor changes to ranges.
There are two basic ways that I see to do this
Way 1
The macro would look basically like this , and be approximately 4 times as long as previously:
_____ If Application.Intersect(Target, Me.Range("A26:A27,C26:C27")) Is Nothing Then
‘ code like before with ranges adjusted appropriately
_____ If Application.Intersect(Target, Me.Range("A29:A30,C29:C30")) Is Nothing Then
‘ code like before with ranges adjusted appropriately
_____ If Application.Intersect(Target, Me.Range("A32:A33,C32:C33")) Is Nothing Then
‘ code like before with ranges adjusted appropriately
_____ If Application.Intersect(Target, Me.Range("A35:A36,C35:C36")) Is Nothing Then
‘ code like before with ranges adjusted appropriately
Way 2
This might require you to slightly reorganise your Advise data so that different sections are at similar offsets to each other
We would then have a macro very similar to the previous starting something like this
_____ If Application.Intersect(Target, Me.Range("A26:A27,C26:C27, A29:A30,C29:C30, A32:A33,C32:C33, A35:A36,C35:C36")) Is Nothing Then
‘ code like before with ranges determined by an offset. This offset will vary according to which of the 4 main ranges were selected
Way 2 would be a shorter code, but would take a bit more brain work to figure out the logic
I expect if I was in your position, I would do it in Way 1. There are no real advantages of Way 2
There are no problems with having a macro 4 times as long as the previous one, and you don’t need to type it all,
since you can get most of it by copying ( Ctrl+c ) and pasting ( Ctrl+v ) what you already have.
I am not sure how I can help further?
Tell me if you want me to make a start for you as I did before.
Alan





Reply With Quote
Bookmarks