Hello All,
The below code is not working when I change the criteria(line 17) from a number to a text. Can anyone help?
Do i need to do anything to Line 11?
I want to pick up any rows in which Column T contains the word DSM and move a range of columns(Line 20- (RawData) to columns A-E in Sheet D.
The below code is not working when I change the criteria(line 17) from a number to a text. Can anyone help?
Do i need to do anything to Line 11?
I want to pick up any rows in which Column T contains the word DSM and move a range of columns(Line 20- (RawData) to columns A-E in Sheet D.
VBA Code:
[LIST=1]
[*]Sub DMSL()
[*]
[*] Dim xRg As Range
[*] Dim xCell As Range
[*] Dim i As Long
[*] Dim J As Long
[*] Dim K As Long
[*] i = Worksheets("RawData").UsedRange.Rows.Count
[*] J = Worksheets("D").UsedRange.Rows.Count
[*] If J = 1 Then
[*] If Application.WorksheetFunction.CountA(Worksheets("D").UsedRange) = "0" Then J = 0
[*] End If
[*] Set xRg = Worksheets("RawData").Range("T1:T" & i)
[*] On Error Resume Next
[*] Application.ScreenUpdating = False
[*] For K = 1 To xRg.Count
[*] If CStr(xRg(K).value) = "DSM" Then
[*] J = J + 1
[*] With Worksheets("RawData")
[*] Intersect(.Rows(xRg(K).Row), .Range("D5:D577,F5:F577,J5:L577,W5:W577")).Copy Destination:=Worksheets("D").Range("A" & J)
[*] End With
[*]
[*] End If
[*] Next
[*] Application.ScreenUpdating = True
[/LIST]