kevinchurchill
New Member
- Joined
- Jul 20, 2015
- Messages
- 26
Hello all, I have a problem copying and pasting from one master sheet to its respetive heading sheet, I keep getting error 1004.
So for example in range R i have drop down boxes in each line, in these boxes i select for example production, quality, methodes ect...
So when for example i select Production and have filled out the row of information relating to a production proble, when I execute the macro i would like the row copied from the master sheet and pasted into the next available row in the Production sheet and the same goes for what ever heading I select from the dropdown list to there respective sheet.
here is a copy of the code that I have tried to use but not having any success with, I might add that the same code worked on a different spreadsheet with different headings but all the sheets were formated exactly the same as the master sheet all I have done is alter the names of the sheets.
Any help would be much aprieciated.
Sub CutData()
Dim PRODUCTION As String, Cell As Range, PRODUCTION_ As Range
'Production'
PRODUCTION = "Production"
For Each Cell In Range("R16:R200")
If InStr(1, PRODUCTION, Cell.Value, vbTextCompare) > 0 Then
If PRODUCTION_ Is Nothing Then
Set PRODUCTION_ = Cell
Else
Set PRODUCTION_ = Union(PRODUCTION_, Cell)
End If
End If
Next
If Not PRODUCTION_ Is Nothing Then
PRODUCTION_.EntireRow.Copy Destination:=Sheets("Production").Range("A16")
End If
End Sub
So for example in range R i have drop down boxes in each line, in these boxes i select for example production, quality, methodes ect...
So when for example i select Production and have filled out the row of information relating to a production proble, when I execute the macro i would like the row copied from the master sheet and pasted into the next available row in the Production sheet and the same goes for what ever heading I select from the dropdown list to there respective sheet.
here is a copy of the code that I have tried to use but not having any success with, I might add that the same code worked on a different spreadsheet with different headings but all the sheets were formated exactly the same as the master sheet all I have done is alter the names of the sheets.
Any help would be much aprieciated.
Sub CutData()
Dim PRODUCTION As String, Cell As Range, PRODUCTION_ As Range
'Production'
PRODUCTION = "Production"
For Each Cell In Range("R16:R200")
If InStr(1, PRODUCTION, Cell.Value, vbTextCompare) > 0 Then
If PRODUCTION_ Is Nothing Then
Set PRODUCTION_ = Cell
Else
Set PRODUCTION_ = Union(PRODUCTION_, Cell)
End If
End If
Next
If Not PRODUCTION_ Is Nothing Then
PRODUCTION_.EntireRow.Copy Destination:=Sheets("Production").Range("A16")
End If
End Sub