Worksheet Change Event When A Cell Is Changed From A Dynamic Range

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
3,812
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I'm going to try to explain this the best I can with my limited vba vocabulary.

I have a worksheet that gets populated dynamically through VBA. The number of rows of data are always changing with each query from the user, but the presentation format of the data is always consistent. The data is presented over 8 columns from column A:H. Each cell in each dynamic range (column & number of rows) has a list validation. What I am trying to accomplish is that when a user changes the value in a particular cell within that range (column) a procedure is executed. Each column of values will have a unique procedure called.

So, it would be a worksheet change event. I already have one, but it's a static cell that is active all the time. I don't know though how to add these events to the worksheet change when they are dynamic and created from other code. I can't code it (to my knowledge) into the worksheet change module until I know the range of cells to check). The ranges are in place, now I have to ensure the worksheet change code is watching for these changes in each respective column.

I hope I make enough sense that someone can provide some direction.
 

Some videos you may like

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

mumps

Well-known Member
Joined
Apr 11, 2012
Messages
10,160
I'm not sure if I understood properly but see if this works for you.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("A:H")) Is Nothing Then Exit Sub
    Select Case Target.Column
        Case Is = 1
            'execute procedure1
        Case Is = 2
            'execute procedure2
        Case Is = 3
            'execute procedure3
        Case Is = 4
            'execute procedure4
        Case Is = 5
            'execute procedure5
        Case Is = 6
            'execute procedure6
        Case Is = 7
            'execute procedure7
        Case Is = 8
            'execute procedure8
    End Select
End Sub

If it doesn't work, please use the XL2BB add-in (icon in the menu) to attach a screenshot (not a picture) of your sheet. Alternately, you could upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. Explain in detail what you want to do referring to specific cells, rows, columns and sheets using a few examples from your data (de-sensitized if necessary).
 
Solution

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
3,812
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Thanks Mumps! On my first run through, this seems like a solution that will work for me! I had to review my code and lock and unlock certain cells as to prevent the user from initiated procedures by entering data in an empty cell. But it's early, and knowing me it'll backfire at some point. I really hope I'm wrong!
 
Last edited:

mumps

Well-known Member
Joined
Apr 11, 2012
Messages
10,160
You are very welcome. Let me know if I can be of further help. :)
 

Watch MrExcel Video

Forum statistics

Threads
1,123,248
Messages
5,600,536
Members
414,385
Latest member
PARAMATHMA SENTHILNATHAN

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
Top