agonysWeeper
Board Regular
- Joined
- Feb 4, 2011
- Messages
- 146
Hi,
i found this code from google and trying to work and apply to my worksheet, I have a large data around 35K rows and being updated everyday.
column A to AU are being updated by pasting value the large data all the way down. I am trying to apply the below code to populate the data from column number 30 which is AD and populate the result from AV2 (row 1 is the header) based from the logic below, the problem is that every time I paste the large data, it's doesn't work at all, it will just work when I manually enter in first data in AD2 and press enter, then its populates.
I am not much good with the macro so sorry about this
i found this code from google and trying to work and apply to my worksheet, I have a large data around 35K rows and being updated everyday.
column A to AU are being updated by pasting value the large data all the way down. I am trying to apply the below code to populate the data from column number 30 which is AD and populate the result from AV2 (row 1 is the header) based from the logic below, the problem is that every time I paste the large data, it's doesn't work at all, it will just work when I manually enter in first data in AD2 and press enter, then its populates.
I am not much good with the macro so sorry about this
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
If Target.Count = 1 Then
If Target.Column = 30 Then
Application.EnableEvents = False
For Each cell In Range("AV1").Offset(Target.Row - 1)
If cell.Value <> "" Then cell.ClearContents
Next cell
Select Case Target.Value
Case "Black"
Range("AV1").Offset(Target.Row - 1).Value = "Out"
Case "Red"
Range("AV1").Offset(Target.Row - 1).Value = "In"
Case "Green"
Range("AV1").Offset(Target.Row - 1).Value = "Processing"
Case Is <> "Black", "Green", "Red"
Range("AV1").Offset(Target.Row - 1).Value = Range("AD1").Copy
End Select
Application.EnableEvents = True
End If
End If
End Sub