debschofield
New Member
- Joined
- Oct 1, 2019
- Messages
- 10
HI - I wonder if someone can tell me where I have gone wrong? Thank you ![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Sub TestMacro()
' written to test look up of data in raw data spreadsheet and copy/paste to another sheet
' I want to select the data in column AA and filter on only items that map to type 01. Income from the VLOOKUP table
' I then want to copy/paste only the Income items from the GL Raw data worksheet (columns A to U) to the Income Data worksheet
' I think the best approach is to autofilter on column AA which is field 27
With ThisWorkbook.Sheets("GL Raw Data").Select
. I've checked the worksheet name and this is correct
.AutoFilter field:=27, Criteria1:="1. Income"
End With
Sheets("GL Raw Data").Select
Copyvalues.Range ("A:U")
'I think the below command will correctly paste the data
Sheets("Income Data").Select
'***Insert Values
WKS.Range("A1").PasteSpecial xlPasteValues
'Then we need to refresh the Income Pivot, close the income data worksheet and return to the header worksheet
End Sub
Sub TestMacro()
' written to test look up of data in raw data spreadsheet and copy/paste to another sheet
' I want to select the data in column AA and filter on only items that map to type 01. Income from the VLOOKUP table
' I then want to copy/paste only the Income items from the GL Raw data worksheet (columns A to U) to the Income Data worksheet
' I think the best approach is to autofilter on column AA which is field 27
With ThisWorkbook.Sheets("GL Raw Data").Select
![clip_image001.png](/board/proxy.php?image=http%3A%2F%2Ffile%3A%2F%2F%2FC%3A%2FUsers%2FDEBORA%7E1.SCH%2FAppData%2FLocal%2FTemp%2Fmsohtmlclip1%2F01%2Fclip_image001.png&hash=89ebbcfd8eb54614ba8e19917d176a20)
.AutoFilter field:=27, Criteria1:="1. Income"
End With
Sheets("GL Raw Data").Select
Copyvalues.Range ("A:U")
'I think the below command will correctly paste the data
Sheets("Income Data").Select
'***Insert Values
WKS.Range("A1").PasteSpecial xlPasteValues
'Then we need to refresh the Income Pivot, close the income data worksheet and return to the header worksheet
End Sub