Change event with drag and drop enabled

arcaidius

Board Regular
Joined
Dec 4, 2018
Messages
97
Hi,
I have a change event on a sheet to change certain cell values when another cell changes. The problem is it is not working when I drag down that cell, for instance the numbers I am entering in the trigger cell are sequential, so when I drag them down to auto fill, the other cells do not change. Anyone know how to fix this? I tried to find an answer and thought this would work but it doesn't
VBA Code:
Application.CellDragAndDrop = True

Here is my code:

VBA Code:
Dim xCellColumn As Integer
Dim xTimeColumn As Integer
Dim xWorkColumn As Integer
Dim xMachColumn As Integer
Dim xEndColumn As Integer
Dim xShiftColumn As Integer
Dim xRow, xCol As Integer
Dim xDPRg, xRg As Range
xCellColumn = 3
xTimeColumn = 7
xWorkColumn = 1
xMachColumn = 2
xEndColumn = 4
xShiftColumn = 6
xRow = Target.Row
xCol = Target.Column
If Target.Text <> "" Then
    If xCol = xCellColumn Then
       Cells(xRow, xTimeColumn) = Now()
       Cells(xRow, xWorkColumn) = Range("K1").Value
       Cells(xRow, xMachColumn) = Range("E1").Value
       Cells(xRow, xEndColumn) = Range("E2").Value
       Cells(xRow, xShiftColumn) = Range("E3").Value
    Else
        On Error Resume Next
        Set xDPRg = Target.Dependents
        For Each xRg In xDPRg
            If xRg.Column = xCellColumn Then
                Cells(xRg.Row, xTimeColumn) = Now()
            End If
        Next
    End If
End If
End Sub
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
you did not include the name of the sub
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,199
Members
453,022
Latest member
RobertV1609

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