Hi all, I'm looking for a way to simplify the following step through looping. Appreciate any help to teach me simple steps for looping.
Basically, I just want to copy cells from one sheet, "Input" and paste the data into a sheet which name is written in cell (C5) in "Input"
Since I have 30 sheets, a loop will make it more simple and organize, written below is only for 3 sheets, "T-1", "T1" and "T2"
Actual sheets name range from "T-7" to "T23", but T0 does not exist.
Thank you for your help, I guess it will take only few minutes of your time.
Basically, I just want to copy cells from one sheet, "Input" and paste the data into a sheet which name is written in cell (C5) in "Input"
Since I have 30 sheets, a loop will make it more simple and organize, written below is only for 3 sheets, "T-1", "T1" and "T2"
Actual sheets name range from "T-7" to "T23", but T0 does not exist.
Thank you for your help, I guess it will take only few minutes of your time.
VBA Code:
Sub DailyInput()
Sheets("Input").Select
If Range("C5") = "T-1" Then
Range("A5").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("T-1").Range("A3").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Sheets("Input").Range("A7:EY1206").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("T-1").Range("A5:EY1204").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
'----------------------------------------------------------------------------------------'
Sheets("Input").Select
If Range("C5") = "T1" Then
Range("A5").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("T1").Range("A3").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Sheets("Input").Range("A7:EY1206").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("T1").Range("A5:EY1204").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
'----------------------------------------------------------------------------------------'
Sheets("Input").Select
If Range("C5") = "T2" Then
Range("A5").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("T2").Range("A3").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Sheets("Input").Range("A7:EY1206").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("T2").Range("A5:EY1204").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End Sub
Last edited by a moderator: