VBA Record when a new row of information is added to data set

Lbdch

New Member
Joined
Apr 25, 2022
Messages
9
Office Version
  1. 365
Platform
  1. Windows
I would like to find a better way to record when a new row of information is populated in a data set. Currently I have some code that checks when the values are populated in adjacent columns C,D and E, once a value is populated in all of them it records the sheet name and row address in a separate sheet. Its incredibly slow however and I was wondering if anyone has a better way of accomplishing this? Essentially record row address when multiple values have been entered in the row.

This is my code currently -

VBA Code:
Dim srg As Range: Set srg = Intersect(irg.EntireRow, crg)
    Dim sName As String: sName = ActiveSheet.Name
     
    Dim dws As Worksheet: Set dws = Worksheets(dName)
    Dim dfCell As Range: Dim ddcrg As Range: Set ddcrg = dws.Columns(dcCol)
    
    Dim arg As Range
    Dim rrg As Range
    Dim srAddress As String
    Dim ddFound As Range
    
  
 
    
    For Each arg In srg.Areas
        For Each rrg In arg.Rows
            srAddress = sName & "!" & rrg.Address(0, 0)
            Set ddFound = ddcrg.Find(srAddress, , xlFormulas, xlWhole)
            If Application.CountBlank(rrg) = 0 Then
            
             If ddFound Is Nothing Then
                
                With Sheets("Log")
                    Set dfCell = dws.Cells(dws.Rows.Count, dCol) _
                        .End(xlUp).Offset(1)
                        dfCell.Value = Format(Date, "mm/dd/yyyy")
                        dfCell.Offset(, 1).Value = ActiveSheet.Name
                        dfCell.Offset(, 2).Value = srAddress
                End With
            End If
         End If
       Next
    Next

If anyone had any suggestions or suggestions or learning resources it would be greatly appreciated.

I'm hoping to get more information; have already asked this question on StackOverflow under: VBA Record when a new row is populated
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,223,900
Messages
6,175,276
Members
452,629
Latest member
SahilPolekar

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