Anandpersad
New Member
- Joined
- Oct 18, 2014
- Messages
- 31
Hi All,
Can someone please help me with the following issue:
VBA will open file Kenneth.xlsx.
In this file the filtered data has to be copied into. This file has several sheets (all sheets have a unique name). Based on the filtered data from “working”file “In Macro V 1.xlsm”, data has to copy to the correct sheet in file Kenneth.xlsx. So, I have two different files (documents).
Below is the macro I have now. All is working fine, until I get to "Sheets("Anand").Select". I am not able to paste the selected data from “In Macro V 1.xlsm” to “sheet Anand” in file “Kenneth.xlsx”
I think I got all the possible error codes, as I tried several solutions. Now, I have no idea how to proceed further.
The macro is as follows:
Sub Copy_Rows()
'To copy the selected rows to the destiny file
Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long
Dim ViewMode As Long
Workbooks.Open Filename:="C:\Users\Kenneth"
Workbooks("In Macro V 1.xlsm").Activate
Sheets("Bench").Select
Range("A1").Select
Selection.AutoFilter
ActiveSheet.Range("A:CC").AutoFilter Field:=10, Criteria1:="="
Range("A1:CC1").Select
Dim rng As Range
Set rng = Application.Intersect(ActiveSheet.UsedRange, Range("A:CC"))
rng.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Workbooks("Kenneth.xlsx").Activate
Workbooks("Kenneth.xlsx").Select
Sheets("Anand").Select
Range("A1").Select
ActiveSheet.Paste
'Selection.Paste
Range("A1").Select
Windows("In Macro V 1.xlsm ").Activate
Range("A1").Select
End Sub
Can someone please help me with the following issue:
VBA will open file Kenneth.xlsx.
In this file the filtered data has to be copied into. This file has several sheets (all sheets have a unique name). Based on the filtered data from “working”file “In Macro V 1.xlsm”, data has to copy to the correct sheet in file Kenneth.xlsx. So, I have two different files (documents).
Below is the macro I have now. All is working fine, until I get to "Sheets("Anand").Select". I am not able to paste the selected data from “In Macro V 1.xlsm” to “sheet Anand” in file “Kenneth.xlsx”
I think I got all the possible error codes, as I tried several solutions. Now, I have no idea how to proceed further.
The macro is as follows:
Sub Copy_Rows()
'To copy the selected rows to the destiny file
Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long
Dim ViewMode As Long
Workbooks.Open Filename:="C:\Users\Kenneth"
Workbooks("In Macro V 1.xlsm").Activate
Sheets("Bench").Select
Range("A1").Select
Selection.AutoFilter
ActiveSheet.Range("A:CC").AutoFilter Field:=10, Criteria1:="="
Range("A1:CC1").Select
Dim rng As Range
Set rng = Application.Intersect(ActiveSheet.UsedRange, Range("A:CC"))
rng.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Workbooks("Kenneth.xlsx").Activate
Workbooks("Kenneth.xlsx").Select
Sheets("Anand").Select
Range("A1").Select
ActiveSheet.Paste
'Selection.Paste
Range("A1").Select
Windows("In Macro V 1.xlsm ").Activate
Range("A1").Select
End Sub