Hi Masters,
I have a macro coded : It copy all values <=12 in V2, and also name “James” on column 20 and “OES” on column 10.
It create a new tab with name “James” for all “OES” if V2 less then 12.
I need to have a second macros that does same search for the same names but instead of “OES” to look for “OE” and name new tab “James-OE”
Thank you:
I have a macro coded : It copy all values <=12 in V2, and also name “James” on column 20 and “OES” on column 10.
It create a new tab with name “James” for all “OES” if V2 less then 12.
I need to have a second macros that does same search for the same names but instead of “OES” to look for “OE” and name new tab “James-OE”
Thank you:
VBA Code:
Sub TestTim()
test3 "OES", "Tim"
End Sub
Sub TestGeorge()
test3 "OES", "George"
End Sub
Sub test3(Category As String, FirstName As String)
Dim outarr()
Dim inarr As Variant, indi As Long, I As Long, J As Long '<<<< missing variable declarations.
inarr = Range("A1:V7500").Value
ReDim outarr(1 To 7500, 1 To 22)
indi = 1
For I = 2 To 7500
If UCase(inarr(I, 10)) = UCase(Category) And UCase(inarr(I, 20)) = UCase(FirstName) And inarr(I, 22) <= 12 Then
' copy row
For J = 1 To 22
outarr(indi, J) = inarr(I, J)
Next J
indi = indi + 1
End If
Next I
Worksheets.Add
ActiveSheet.Name = FirstName
If indi > 1 Then
Range(Cells(1, 1), Cells(indi - 1, 22)) = outarr
End If
End Sub
Last edited by a moderator: