Worksheet_change: pass target.row to dynamic array

nikaleya

New Member
Joined
Feb 15, 2021
Messages
13
Office Version
  1. 365
Platform
  1. Windows
Hi guys,

I need your help! For a project I try to create a "database" (worksheet) where data gets imported and can be updated.

After the import of the data (query) I track the changes with the worksheet_change event followed by a function to throw the corresponding row number.
VBA Code:
'track cells which have changes
Public Sub Worksheet_Change(ByVal target As Range)

'give range of changed cells
Debug.Print "Something changed in cell " & target.Address(0, 0)

Call target4changes(target)

Code:
Public Function target4changes(target As Range)

MsgBox target.Address

End Function

The idea is to pass the single row numbers to a dynamic array and then loop through the array to copy the affected rows to another sheet (like an archive).
How can I pass the row numbers to an array and where should I create the array to make sure it's "empty" after data import?

Any help is very much appreciated!
Nika
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,214,653
Messages
6,120,751
Members
448,989
Latest member
mariah3

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