i need a macro that automatically runs when data is typed or pasted into cells

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,201
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
hi everyone,

please help ive been playing around with this all morning and getting nowhere

I have 5 columns S:W that take data

when data is put into all 5 of the columns i need to trigger a macro that can run another macro on every row that has been entered,

so to give a bit of background i created an input area and now everyone is pasting in batchs of data instead of just typing it in one row at a time so my macro no longer works,
however if posible what id like is to have a macro that triggers autoomaticly when the data is both typed in or pasted in,

so the macro if it was in english would read,

If data is typed or pasted into columns S,T,U,V or W then
for each row of data typed or pasted in if Column A is empty (i say empty as in contains nothing, as some might have formulas in) then run macro "Fillit"

end sub

so thats it, sounds easy, but i'm have trouble because i dont want it runing if its already put the data in
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    startcol = 19
    endcol = 23
    If Target.Column >= startcol And Target.Column <= endcol Then
        EnableEvents = False
        For Each r In Target.Rows
            t = 0
            For Each c In ActiveSheet.Range(Cells(r.Row, startcol), Cells(r.Row, endcol))
                If Not IsEmpty(c) Then t = t + 1
            Next
            If t = (endcol - startcol + 1) And IsEmpty(ActiveSheet.Cells(r.Row, 1)) Then FillIt r.Row
        Next
        EnableEvents = True
    End If
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,215,777
Messages
6,126,835
Members
449,343
Latest member
DEWS2031

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