mohammadhdr
New Member
- Joined
- Aug 26, 2021
- Messages
- 3
- Office Version
- 2019
- Platform
- Windows
Hi All,
I have a data analysis sheet that Im currently working on. I have a drop down list with different entries and I want my code to a copy specific cells (C102:G105) and depending on the drop down menu selection change the paste location of cell in different sheet. I have some of the code already done but it simply copies the cell and pastes it in a certain location in a different. If someone could help me out I would really appreciate it. Here is the code:
Private Sub Save()
Application.ScreenUpdating = False
Dim xSWName As String
Dim xSheet As Worksheet
Dim xPSheet As Worksheet
xSWName = "Results"
On Error Resume Next
Application.ScreenUpdating = False
Set xSheet = ActiveSheet
If xSheet.Name <> "Definitions" And xSheet.Name <> "fx" And xSheet.Name <> "Needs" Then
xSheet.Range("C102:G105").Copy
Set xPSheet = Worksheets.Item(xSWName)
xPSheet.Cells(5, 5).PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End If
Application.ScreenUpdating = True
End Sub
I have a data analysis sheet that Im currently working on. I have a drop down list with different entries and I want my code to a copy specific cells (C102:G105) and depending on the drop down menu selection change the paste location of cell in different sheet. I have some of the code already done but it simply copies the cell and pastes it in a certain location in a different. If someone could help me out I would really appreciate it. Here is the code:
Private Sub Save()
Application.ScreenUpdating = False
Dim xSWName As String
Dim xSheet As Worksheet
Dim xPSheet As Worksheet
xSWName = "Results"
On Error Resume Next
Application.ScreenUpdating = False
Set xSheet = ActiveSheet
If xSheet.Name <> "Definitions" And xSheet.Name <> "fx" And xSheet.Name <> "Needs" Then
xSheet.Range("C102:G105").Copy
Set xPSheet = Worksheets.Item(xSWName)
xPSheet.Cells(5, 5).PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End If
Application.ScreenUpdating = True
End Sub