Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dear All,
I populate a csv file using data from our data warehouse and import it as .csv. I wish to Activate that file and count the number of rows and record this in another workbooks sheet. E.g. In the CSV file Dim Work As Workbook Dim Figures As Workbook Set Work = Workbooks.Open("N:\Work.csv") Set Figures = Workbooks.Open("N:\mmyy.xls") Work.Activate Range("A1").Select Range(Selection, Selection.End(xlDown)).Select myCount = Selection.Rows.Count Figures.Activate Range("A1").Select Selection.End(xlDown).Select ActiveCell.Offset(1, 0).Select myCount.Paste The xlDown is to skip part the previous months result. Why isn't the count working, do I need to convert the numbers? Should I say the data (.dtf file) as a different format from the i-Series insteand of .csv? Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Question: what are you pasting, there is not copy? The figures.activate may
be causing problems. Using Select method can create lots of problems. It is better to set Variables and use WITH method. Dim Work As Workbook Dim Figures As Workbook Set Work = Workbooks.Open("N:\Work.csv") Set Figures = Workbooks.Open("N:\mmyy.xls") with Work Set Lastcell = .Range("A1").End(xlDown) Set Countrange = .Range(.Range("A1"), LastCell) myCount = Countrange.Rows.Count Figures.Activate LastCell.Offset(1, 0).Paste end with "Simon" wrote: Dear All, I populate a csv file using data from our data warehouse and import it as .csv. I wish to Activate that file and count the number of rows and record this in another workbooks sheet. E.g. In the CSV file Dim Work As Workbook Dim Figures As Workbook Set Work = Workbooks.Open("N:\Work.csv") Set Figures = Workbooks.Open("N:\mmyy.xls") Work.Activate Range("A1").Select Range(Selection, Selection.End(xlDown)).Select myCount = Selection.Rows.Count Figures.Activate Range("A1").Select Selection.End(xlDown).Select ActiveCell.Offset(1, 0).Select myCount.Paste The xlDown is to skip part the previous months result. Why isn't the count working, do I need to convert the numbers? Should I say the data (.dtf file) as a different format from the i-Series insteand of .csv? Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
count count multiple rows | Excel Discussion (Misc queries) | |||
Count of Worksheet rows and recording this count | Excel Programming | |||
Count rows and insert number to count them. | Excel Discussion (Misc queries) | |||
Function to display a count of visible cells/rows... doesn't | Excel Programming | |||
Function to Count Number of Consecutive Rows with a Specific Criteria? | Excel Worksheet Functions |