Paste data from another worksheet
I am currently trying to paste information from a main worksheet onto different worksheets based on the divisions. I can get it to copy the data, but cannot get it over to the new worksheet. Here is the code:
Private Sub CommandButton1_Click() Dim a As Integer, b As Integer, c As Integer, rng As Range, div As String Set rng = Range("A3:I1002") a = 3 b = 2 c = 2 For a = 3 To 20 div = Cells(a, 8).Value If Cells(a, 1).Value < 10000 Then Exit For End If Select Case div Case "Mold Build" rng.Rows(a - 2).Copy Worksheets(2).Activate **** This is where the paste should go, but I can't get it to work b = b + 1 Worksheets(1).Activate Case Else rng.Rows(a - 2).Copy Worksheets(3).Activate **** This is where the paste should go, but I can't get it to work c = c + 1 Worksheets(1).Activate End Select Next a End Sub |
All times are GMT +1. The time now is 08:47 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com