Envoke code with button rather than as data is entered.

J

JOUIOUI

I'm using this code to populate the WS "Summary" if any of the other
worksheets in the WB have data in Col A and B. As col A and B have text
entered into them, it also goes to the Summary WS in Col A and B respectively
with the source WS name in Col C. I would like to alter this code to have
it launch with a button rather than when data is entered into the worksheets.
Any suggestions on how to do this? Also I need the summary WS to populate
in columns B, C and D instead of A, B and C since I now have the row numbers
in col A. Thanks again.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If IsEmpty(Target.Value) Then Exit Sub
If Target.Column = 2 Then
Application.Screenupdating = False
With Sheets("Summary")
Target.Offset(, -1).Resize(, 2).Copy
..Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial
..Range("C" & Rows.Count).End(xlUp).Offset(1).Value = Me.Name
End With
Application.Screenupdating = True
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top