How to transfer results from one sheet to different sheets based on some condition VBA

terryjohn

New Member
Joined
Nov 16, 2018
Messages
2
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
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
anyone can help me? Or is it clear, what I need? I was going threw forum,but could not find something similar for me..
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top