Hey guys i have a excel 2003 document with 9 sheets, 8 per parc and the 9 for the result.
Then I get how many GF , GP thah have every employer indicating the name, and parcnumber etc... in the result sheet executing a macro clicking "Obtener datos".
But now, i changed the Parcnumber to Parcname in every sheet and also,i changed the name of the sheet.

So when i did it, the macro doesnt'work or not appear nothing the result sheet.
I want get the next dates result:
My code is this:
Option Explicit
Option Base 1
Option Compare Text
Dim M(), fm&
Dim R, fr&, fu%, uf&, fila&
Dim Q&, i%, j%, arr
Dim fecha&, DD%, MM%, YY%
Dim G%, GR%, GP%, GF%, GC%, GE%, GRC%, GPC%, GFC%, COLUMNA%, QG$
Sub OBTENER·NUM·REG()
Dim H As Worksheet
Dim S As Worksheet
fm = 0
arr = Array("January", "February", "March", "April", "May", "June", "July", _
"August", "September", "October", "November", "December")
Q = 0
For Each H In Worksheets
If H.Name Like "Parc*" Then
With H
fu = .Range("A:A").Find("Parc").Row + 1
uf = .Range("A" & Rows.Count).End(xlUp).Row
Q = Q + (uf - fu + 1) * 31
For i = 1 To 12
If arr(i) = .Range("a2") Then
YY = Year(Now)
MM = Month(CDate("01/" & i & "/" & YY))
Exit For
End If
Next
End With
End If
Next
ReDim M(Q, 12)
For Each H In Worksheets
If H.Name Like "Parc*" Then
With H
fu = .Range("A:A").Find("Parc").Row + 1
uf = .Range("A" & Rows.Count).End(xlUp).Row
Set R = .Range(.Cells(fu, 1), .Cells(uf, 129))
For fr = 1 To R.Rows.Count
fila = R(fr, 1).Row
If Len(Trim(R(fr, 1))) > 0 Then
For i = 6 To 126 Step 4
For j = i To i + 3
QG = .Cells(fila, j)
Select Case QG
Case "G": G = G + 1: COLUMNA = 4: GoSub REGISTRAR·DATO: Exit For
Case "GR": GR = GR + 1: COLUMNA = 5: GoSub REGISTRAR·DATO: Exit For
Case "GP": GP = GP + 1: COLUMNA = 6: GoSub REGISTRAR·DATO: Exit For
Case "GF": GF = GF + 1: COLUMNA = 7: GoSub REGISTRAR·DATO: Exit For
Case "GC": GC = GC + 1: COLUMNA = 8: GoSub REGISTRAR·DATO: Exit For
Case "GE": GE = GE + 1: COLUMNA = 9: GoSub REGISTRAR·DATO: Exit For
Case "GRC": GRC = GRC + 1: COLUMNA = 10: GoSub REGISTRAR·DATO: Exit For
Case "GPC": GPC = GPC + 1: COLUMNA = 11: GoSub REGISTRAR·DATO: Exit For
Case "GFC": GFC = GFC + 1: COLUMNA = 12: GoSub REGISTRAR·DATO: Exit For
Stop
End Select
Next
Next
End If
Next
End With
End If
Next
SACAR·DATOS
ORDENAR·DATOS
Exit Sub
REGISTRAR·DATO:
'Stop
fm = fm + 1
M(fm, 1) = H.Cells(fila, 1)
M(fm, 2) = H.Name
M(fm, 3) = CDbl(CDate(H.Cells(4, i) & "/" & MM & "/" & YY))
M(fm, COLUMNA) = 1
Return
End Sub
Private Sub SACAR·DATOS()
On Error Resume Next
Application.DisplayAlerts = False
Sheets("Result").Select
On Error GoTo 0
Cells.ClearContents
Range("A1").Resize(, 12) = Array("NOM", "PARC", "DATA", "G", "GR", "GP", "GF", "GC", "GE", "GRC", "GPC", "GFC")
Range("A1").Resize(, 12).Font.Bold = True
Range("C2").Resize(fm).NumberFormat = "DD/MM/YYYY"
MsgBox "Continuar ..."
Application.ScreenUpdating = False
Range("A2").Resize(fm, 12) = M
Range("A:F").Columns.AutoFit
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Cells(1, 1).Select
ActiveWindow.ScrollRow = ActiveCell.Row
End Sub
Private Sub ORDENAR·DATOS()
Dim R As Range, fr&
Set R = Range("a1").CurrentRegion
Dim Q&
Q = R.Rows.Count
ActiveWorkbook.Worksheets("Result").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Result").Sort.SortFields.Add Key:=Range("B2:B" & Q), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("Result").Sort.SortFields.Add Key:=Range("A2:A" & Q), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("Result").Sort.SortFields.Add Key:=Range("C2:C" & Q), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Result").Sort
.SetRange Range("A1:F" & Q)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
For fr = 3 To R.Rows.Count
If R(fr, 1) & R(fr, 2) = R(fr - 1, 1) & R(fr - 1, 2) Then
R(fr, 1) = ""
R(fr, 2) = ""
fr = fr + 1
End If
Next
End Sub
Then How can i get the parcname in the result sheet?



Focusing only on the name changes, I think there are other changes you should make, however, the general parts to focus on are as below.
Note: I have used a function to return the sheet names to loop over. These must be spelt the same in the sheet and as the sheet names i.e. same case, same accents, same spelling e.g.
CalvianotCalviaandCalvià. Whilst the sentence case matching may not be essential I would consider it good practice. You can setMatchCasetoFalsefor the Find and useLookAt:=xlPartto get partial match but I would go with being specific. You should also consider using a check that all worksheets are present.You can then use the sheet name in your find e.g. H.Name
I have included Private Sub SACAR·DATOS() as it references "PARC" but I am not sure what you will do with it. I can amend this with further information but you should be aware of this and review.