vikas_newports
Board Regular
- Joined
- May 26, 2016
- Messages
- 121
- Office Version
- 365
- Platform
- Windows
Hello
Have a great day, I am very new to Macros and want to create a dynamic macro and automate my day to day task .
I wrote code to copy data from other workbooks and append it on other workbook(testmac)
I applied a filter and select the All amount which are greater than Zero in Column K
Now I want to write " 0 " in all Filtered Cells (visible Cells) in Column K
I am stuck and unable to do this , looking for a better from your end.
I need more help in this code that how can I get rid of the manual file path, I want it as just run it from any folder without changing the path in code.
Here is my code
Please note I posted same question on excelforum but out of luck
Have a great day, I am very new to Macros and want to create a dynamic macro and automate my day to day task .
I wrote code to copy data from other workbooks and append it on other workbook(testmac)
I applied a filter and select the All amount which are greater than Zero in Column K
Now I want to write " 0 " in all Filtered Cells (visible Cells) in Column K
I am stuck and unable to do this , looking for a better from your end.
I need more help in this code that how can I get rid of the manual file path, I want it as just run it from any folder without changing the path in code.
Here is my code
VBA Code:
Sub testing()
'Open File1 copy data to testmac and close File1
Workbooks.Open "C:\Users\Mark\Desktop\Automation\File1.csv"
Workbooks("File1.csv").Worksheets("File1").Range("A5").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy Workbooks("Testmac.xlsm").Worksheets("DATA").Range("A15")
Workbooks("File1.csv").Close SaveChanges:=False
'Open File2 copy data to testmac and close File2
Workbooks.Open "C:\Users\Mark\Desktop\Automation\File2.csv"
Workbooks("File2.csv").Worksheets("File2").Range("A5").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy Workbooks("Testmac.xlsm").Worksheets("DATA").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
Workbooks("File2.csv").Close SaveChanges:=False
'Filter for Amounts greater than Zero
Range("A14:P1048576").AutoFilter Field:=11, Criteria1:=">0"
End Sub
Please note I posted same question on excelforum but out of luck