Hello everyone, Iam beginner with VBA, just trying to find out some solution for one project.
I created survey for evaluation of employees,I have one sheet named Survey, where is 5 questions and the respondent is choosing from drop down list from the scale - excelent,good,poor etc...for each question separate drop down list...above the question,there is another drop down list with names of all the members, who will be rated..and next to it,there is in cell D3 another drop down list, where the respondent have to choose period, for which is that evaluation meant - 1Q 2019,2Q 2019,3Q 2019,4Q 2019.
Also have separate sheets named - Results 1Q 2019,Results 2Q 2019,Results 3Q 2019,Results 4Q 2019.
There is code, which worked just to copy data to first sheet,but then I got new demand, to have more periods,not only one..and then it stoped work....I tried If then condition, but did not work, all the time I had some errors..
So the question is, how to do it, that if I will choose different period to transfer it to correct sheet -> period 1Q 2019 transfer to sheet Results 1Q 2019 etc....code below was created via recording macro and relative references..
Sub CopytoDBwithVBAOption1()
'
' CopytoDBwithVBAOption1 Macro
'
Range("H3:M3").Select
Selection.Copy
Sheets("Results 1Q 2019").Select
Application.Goto Reference:="R10000C1"
ActiveWindow.SmallScroll Down:=40
Selection.End(xlUp).Select
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Survey").Select
Range("D9").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("D8").Select
Selection.ClearContents
Selection.ClearContents
Range("D7").Select
Selection.ClearContents
Range("D6").Select
Selection.ClearContents
Range("D5").Select
Selection.ClearContents
ActiveWindow.LargeScroll ToRight:=-1
Range("C3").Select
Selection.ClearContents
End Sub
I created survey for evaluation of employees,I have one sheet named Survey, where is 5 questions and the respondent is choosing from drop down list from the scale - excelent,good,poor etc...for each question separate drop down list...above the question,there is another drop down list with names of all the members, who will be rated..and next to it,there is in cell D3 another drop down list, where the respondent have to choose period, for which is that evaluation meant - 1Q 2019,2Q 2019,3Q 2019,4Q 2019.
Also have separate sheets named - Results 1Q 2019,Results 2Q 2019,Results 3Q 2019,Results 4Q 2019.
There is code, which worked just to copy data to first sheet,but then I got new demand, to have more periods,not only one..and then it stoped work....I tried If then condition, but did not work, all the time I had some errors..
So the question is, how to do it, that if I will choose different period to transfer it to correct sheet -> period 1Q 2019 transfer to sheet Results 1Q 2019 etc....code below was created via recording macro and relative references..
Sub CopytoDBwithVBAOption1()
'
' CopytoDBwithVBAOption1 Macro
'
Range("H3:M3").Select
Selection.Copy
Sheets("Results 1Q 2019").Select
Application.Goto Reference:="R10000C1"
ActiveWindow.SmallScroll Down:=40
Selection.End(xlUp).Select
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Survey").Select
Range("D9").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("D8").Select
Selection.ClearContents
Selection.ClearContents
Range("D7").Select
Selection.ClearContents
Range("D6").Select
Selection.ClearContents
Range("D5").Select
Selection.ClearContents
ActiveWindow.LargeScroll ToRight:=-1
Range("C3").Select
Selection.ClearContents
End Sub