Ayuda modificación macro
Publicado por JAIME (39 intervenciones) el 21/06/2020 21:49:51
Buenas a todos
Alguien me puede ayudar con esta macros para hacerle una modificación, ya que antes el archivo tenia 2 hojas una llamada turnos 1ª y otra llamada turnos 2º y ahora lo he dejado en una sola hoja llamada Turnos, estoy haciendo pruebas pero no doy con la solución y no puedo subir archivo por que pesa mucho, si alguien puede echarle un vistazo lo agradeceria mucho, y espero que la solución me valga para otras macros que tambien me esta pasando lo mismo,
un saludo y gracias
Jaime
Alguien me puede ayudar con esta macros para hacerle una modificación, ya que antes el archivo tenia 2 hojas una llamada turnos 1ª y otra llamada turnos 2º y ahora lo he dejado en una sola hoja llamada Turnos, estoy haciendo pruebas pero no doy con la solución y no puedo subir archivo por que pesa mucho, si alguien puede echarle un vistazo lo agradeceria mucho, y espero que la solución me valga para otras macros que tambien me esta pasando lo mismo,
un saludo y gracias
Jaime
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Dim i As Integer
Dim k As Integer
Dim j As Integer
Dim o As Integer
Dim col As Integer
Sheets("Patronales").Columns("C:D").ClearContents
Dim turno As String
Dim trab As String
Dim valor As String
Dim busca_trab As String
Dim coment As String
Dim coment2() As String
For o = 1 To 2
turno = "turnos " & o & "º"
For i = 5 To 6
If o = 1 Then
trab = Sheets(turno).Cells(i, 4).Value
ElseIf o = 2 Then
trab = Sheets(turno).Cells(i, 2).Value
End If
For k = 3 To 196
valor = Sheets(turno).Cells(i, k).Value
If valor = "P" Then
For j = 5 To 6
busca_trab = Sheets("Patronales").Cells(j, 1).Value
If busca_trab = trab Then
If IsEmpty(Sheets("Patronales").Cells(i, 3)) Then
Sheets("Patronales").Cells(i, 3).Value = Sheets(turno).Cells(3, k).Value
ElseIf Not IsEmpty(Sheets("Patronales").Cells(i, 3)) And Sheets("Patronales").Cells(i, 3).Value <> Sheets(turno).Cells(3, k).Value Then
Sheets("Patronales").Cells(i, 4).Value = Sheets(turno).Cells(3, k).Value
End If
End If
Next
End If
Next
Next
Next
End Sub
Valora esta pregunta


0