Hi all,
I am extremely new to VBA so I apologize if this is a stupid question. However, I have created this code
I would like to run this code for particular sheets as well as "T_maintained" but do not want to write the code out multiple times, replacing "T_maintained" for each replication of the code with another relevant work sheet. Every other component of the code would remain the same.
Is there a way I can convert the above code into a sort of function, where all I would need to do is type in function("name_of_appropriate_sheet") or something similar so that I do not need to repeat the code multiple times?
Thank you for your help.
I am extremely new to VBA so I apologize if this is a stupid question. However, I have created this code
VBA Code:
sub (format)
Sheets("T_maintained").Select
ActiveCell.Offset(0, 2).Activate
Dim B As Long
For B = 1 To 36
Fill
Next B
Sheets("Mastersheet").Select
ActiveCell.Offset(1, 0).Activate
ActiveCell.Offset(-649, 1).Activate
End Sub
Sub Fill()
Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(18, 0)).Copy
Sheets("Mastersheet").Select
ActiveCell.PasteSpecial Paste:=xlPasteValues
ActiveCell.Offset(18, 0).Activate
Sheets("T_maintained").Select
ActiveCell.Offset(0, 1).Activate
End Sub
I would like to run this code for particular sheets as well as "T_maintained" but do not want to write the code out multiple times, replacing "T_maintained" for each replication of the code with another relevant work sheet. Every other component of the code would remain the same.
Is there a way I can convert the above code into a sort of function, where all I would need to do is type in function("name_of_appropriate_sheet") or something similar so that I do not need to repeat the code multiple times?
Thank you for your help.