chesterrae
Board Regular
- Joined
- Dec 23, 2015
- Messages
- 51
I created a macro that will copy all the values from each month and paste it to [column AK]. The current code is static with fixed ranges and I force to run the macro (using alt+f8) on every sheet since I have multiple sheets.
I'm trying to find a way that will make my codes shorter and more efficient and that will loop to all the sheets doing the same method.
Could you please help me on how to loop this and have it dynamic?
Here's my code:
Sub AttendaceLogger()
'january
Range("B2:AF2").Copy
Range("AK1").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
'february
Range("B3:AC3").Copy
Range("AK32").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
'march
Range("B4:AF4").Copy
Range("AK60").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
'april
Range("B5:AE5").Copy
Range("AK91").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
'may
Range("B6:AE6").Copy
Range("AK121").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
'etc.........
End Sub
Thank you all in advance.
I'm trying to find a way that will make my codes shorter and more efficient and that will loop to all the sheets doing the same method.
Could you please help me on how to loop this and have it dynamic?
Here's my code:
Sub AttendaceLogger()
'january
Range("B2:AF2").Copy
Range("AK1").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
'february
Range("B3:AC3").Copy
Range("AK32").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
'march
Range("B4:AF4").Copy
Range("AK60").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
'april
Range("B5:AE5").Copy
Range("AK91").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
'may
Range("B6:AE6").Copy
Range("AK121").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
'etc.........
End Sub
Thank you all in advance.