¿Cómo copiar si el criterio es igual al nombre de la hoja?
Tengo una hoja llamada "Resumen" en la cual manejo 3 productos:Magna, Premium, Diesel, el nombre del producto se encuentra en la "columna D" pero deseo separarlos, entonces abrí 3 hojas con el nombre de cada producto, intente hacer la macro para separarlos, pero me da " Error de compilación :El uso de la propiedad no es válido"
El pegado de los datos inicia a partir de la Fila 8 en todos los casos
Sub lecturas()
Dim hresumen As Worksheet
Dim hmagna As Worksheet
Dim hpremiun As Worksheet
Dim hdiesel As Worksheet
Set hresumen = Sheets("Resumen")
Set hmagna = Sheets("Magna")
Set hpremiun = Sheets("premiun")
Set hdiesel = Sheets("diesel")
Ini = D8
fin = Range("D" & Rows.Count).End(xlUp).Row
u1 = 8
u2 = 8
u3 = 8
For i = 8 To fin
If Range(Ini).Offset(i).Value = "Magna" Then
hresumen.Range("A" & i & ",B" & i & ",c" & i & ",D" & i & ",E" & i & ",F" & i & ",G" & i & ",H" & i & ",I" & i & ",j" & i & ",K" & i & ",L" & i & ",M" & i & ",N" & i & ",O" & i & ",P" & i & ",Q" & i & ",R" & i & ",s" & i & ",T" & i & ",U" & i & ",V" & i & ",W" & i & ",X" & i & ",Y" & i & ",Z" & i & ",AA" & i & ",AB" & i & ",AC" & i & ",AD" & i & ",AE" & i & ",AF" & i & ",AG" & i & ",AH" & i).Copy
hmagna.Range ("A" & i & ",B" & i & ",c" & i & ",D" & i & ",E" & i & ",F" & i & ",G" & i & ",H" & i & ",I" & i & ",j" & i & ",K" & i & ",L" & i & ",M" & i & ",N" & i & ",O" & i & ",P" & i & ",Q" & i & ",R" & i & ",s" & i & ",T" & i & ",U" & i & ",V" & i & ",W" & i & ",X" & i & ",Y" & i & ",Z" & i & ",AA" & i & ",AB" & i & ",AC" & i & ",AD" & i & ",AE" & i & ",AF" & i & ",AG" & i & ",AH" & i)
If Range(Ini).Offset(i).Value = "Premiun" Then
hresumen.Range("A" & i & ",B" & i & ",c" & i & ",D" & i & ",E" & i & ",F" & i & ",G" & i & ",H" & i & ",I" & i & ",j" & i & ",K" & i & ",L" & i & ",M" & i & ",N" & i & ",O" & i & ",P" & i & ",Q" & i & ",R" & i & ",s" & i & ",T" & i & ",U" & i & ",V" & i & ",W" & i & ",X" & i & ",Y" & i & ",Z" & i & ",AA" & i & ",AB" & i & ",AC" & i & ",AD" & i & ",AE" & i & ",AF" & i & ",AG" & i & ",AH" & i).Copy
hpremiun.Range ("A" & i & ",B" & i & ",c" & i & ",D" & i & ",E" & i & ",F" & i & ",G" & i & ",H" & i & ",I" & i & ",j" & i & ",K" & i & ",L" & i & ",M" & i & ",N" & i & ",O" & i & ",P" & i & ",Q" & i & ",R" & i & ",s" & i & ",T" & i & ",U" & i & ",V" & i & ",W" & i & ",X" & i & ",Y" & i & ",Z" & i & ",AA" & i & ",AB" & i & ",AC" & i & ",AD" & i & ",AE" & i & ",AF" & i & ",AG" & i & ",AH" & i)
Else
hresumen.Range("A" & i & ",B" & i & ",c" & i & ",D" & i & ",E" & i & ",F" & i & ",G" & i & ",H" & i & ",I" & i & ",j" & i & ",K" & i & ",L" & i & ",M" & i & ",N" & i & ",O" & i & ",P" & i & ",Q" & i & ",R" & i & ",s" & i & ",T" & i & ",U" & i & ",V" & i & ",W" & i & ",X" & i & ",Y" & i & ",Z" & i & ",AA" & i & ",AB" & i & ",AC" & i & ",AD" & i & ",AE" & i & ",AF" & i & ",AG" & i & ",AH" & i).Copy
hdiesel.Range ("A" & i & ",B" & i & ",c" & i & ",D" & i & ",E" & i & ",F" & i & ",G" & i & ",H" & i & ",I" & i & ",j" & i & ",K" & i & ",L" & i & ",M" & i & ",N" & i & ",O" & i & ",P" & i & ",Q" & i & ",R" & i & ",s" & i & ",T" & i & ",U" & i & ",V" & i & ",W" & i & ",X" & i & ",Y" & i & ",Z" & i & ",AA" & i & ",AB" & i & ",AC" & i & ",AD" & i & ",AE" & i & ",AF" & i & ",AG" & i & ",AH" & i)
Next
u1 = u1 + 1
u2 = u2 + 1
u3 = u3 + 1
End If
End If
End If
End Sub