PDA

View Full Version : vba to append data by sheets name



ahmed haleem
07-20-2016, 04:31 AM
VBA to Append Data from Excel a single sheet into a multiple worksheets – By Column Without the use of a key to the Macro but in event (change) this sheet

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 3 Then


End If
End Sub

mdmackillop
07-20-2016, 04:52 AM
Here is some code to do some appending, but your description is very vague.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 3 Then
Set ws = ActiveSheet
Set r = Columns(3).SpecialCells(2)
For Each sh In Worksheets
If ws.Name <> sh.Name Then
Set tgt = sh.Cells(Rows.Count, 3).End(xlUp)(2)
r.Copy tgt
End If
Next sh
End If
End Sub

ahmed haleem
07-20-2016, 05:42 AM
Can you see the attached







16687

mdmackillop
07-20-2016, 06:02 AM
Best guess as you have not taken the time to clarify your objectives.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 3 Then
Set ws = ActiveSheet
Set r = Cells(Target.Row, 1).Resize(, 6)
Set tgt = Sheets(Target.Value).Cells(Rows.Count, 1).End(xlUp)(2)
tgt.Resize(, 6).Value = r.Value
End If
End Sub

ahmed haleem
07-20-2016, 06:24 AM
Thanks thanks thanks thanks

ahmed haleem
07-20-2016, 06:36 AM
Finally
Can you explain the code

ahmed haleem
07-20-2016, 06:45 AM
Are there any problems or errors appear when you use the events of the worksheet ؟ Some say I do not use the events of the worksheet..