I am a VBA novice and I am trying to write a code that will copy the following data from multiple csv files all stored in the same directory.
I need it to open each csv file
Check IF Row 8 in columns H through CA for any cells that have the value ="TotalLMP" (Sample: Cell H8="TotalLMP")
THEN copy the value from both Row 7 and Row 19 of any columns that have that value ="TotalLMP" in Row 8 in two new columns (Sample: SINCE H8="TotalLMP", COPY H7="100" AS COLUMN A, COPY H19 = "26.437" AS COLUMN B)
THEN copy the value from cell $A$9 in a third column (Sample: COPY A9="20100101" AS COLUMN C")
after finishing loop through each csv file close and go to next
Then in the new active worksheet in the blank excel file would store each value as follows:
.......A .............. B ................ C
1 .. 100 .... 26.437 .... 20100101
2 .. 200 .... 26.585 .... 20100101
If you have any existing code you should include that in your question - even if it doesn't work. Just posting a requirement, without any indication you've tried to solve it yourself, often leads to questions being closed.
以上就是Extracting certain cells from excel files in a specified directory的详细内容，更多请关注web前端其它相关文章！