Excel_Assis
Board Regular
- Joined
- Feb 19, 2011
- Messages
- 132
- Office Version
- 2016
- Platform
- Windows
Hi
Could I please ask help from someone with VB code.
The VB below should by clicking in the cell column H next to the row of data needed then copy the data to a another sheet at this point it is sheet6 at a specified start cell. There are several source sheets and the selected data from these sheets needs to be copied to sheet6 at a specified starting cell.
At present when the cell is clicked the tick font is made visible meaning the row selected and then viewing the destination sheet. only the first cell of data from source sheet is shown and if two rows are selected from source sheet only the last selected row first cell is shown. Meaning the copy overwrites the previous and does not increment by one row.
Source Sheet = Cost1
B C D E F G H
Select and Copy Code
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("H8:H12")) Is Nothing Then
Target.Font.Name = "Marlett"
If Target = vbNullString Then
Target = "a"
Else
Target = vbNullString
End If
End If
'/// Below code will copy Selected items to sheet6
'Copy Items to sheet6 and start at selected cell and incrament by 1 row.
If Not Intersect(Target, Range("H8:H12")) Is Nothing Then
Select Case Target.Value
Case "a"
Cells(Target.Row, 1).Copy Destination:=Sheet6.Range("D10").End(xlUp).Offset(1, 0)
End Select
End If
End Sub
[/CODE]
Could I please ask help from someone with VB code.
The VB below should by clicking in the cell column H next to the row of data needed then copy the data to a another sheet at this point it is sheet6 at a specified start cell. There are several source sheets and the selected data from these sheets needs to be copied to sheet6 at a specified starting cell.
At present when the cell is clicked the tick font is made visible meaning the row selected and then viewing the destination sheet. only the first cell of data from source sheet is shown and if two rows are selected from source sheet only the last selected row first cell is shown. Meaning the copy overwrites the previous and does not increment by one row.
Source Sheet = Cost1
B C D E F G H
Cost1 | Select Required | |||||
Description | Type | Min # of Units | Cost/Unit | Total | ||
unit 1 | Unit 1 type | 2 | $ 30.00 | $ 60.00 | a | |
unit 2 | Unit 2 type | 0 | $ 5.00 | $ - | ||
unit 3 | Unit 3 type | 3 | $ 20.00 | $ 60.00 | a | |
unit 4 | Unit 4 type | 0 | $ 5.00 | $ - | ||
unit 5 | Unit 5 type | 0 | $ 10.00 | $ - | ||
Total | $ 120.00 |
Select and Copy Code
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("H8:H12")) Is Nothing Then
Target.Font.Name = "Marlett"
If Target = vbNullString Then
Target = "a"
Else
Target = vbNullString
End If
End If
'/// Below code will copy Selected items to sheet6
'Copy Items to sheet6 and start at selected cell and incrament by 1 row.
If Not Intersect(Target, Range("H8:H12")) Is Nothing Then
Select Case Target.Value
Case "a"
Cells(Target.Row, 1).Copy Destination:=Sheet6.Range("D10").End(xlUp).Offset(1, 0)
End Select
End If
End Sub
[/CODE]