LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Count rows, post result in new book

On 7 apr, 15:53, Joel wrote:
Here is the routinne to save the last row. *Again, I would save the file as
CSV which is a text file and an excel file. *It would be only a few bytes of
text rather than a 20K file. *The code below uses a pop up for the filename. *
You can hardcode the filename is that is what you want.

Private Sub SaveLastRow()

LastRow = Range("A" & Rows.Count).End(xlUp).Row

'ChDir "A:\Anotherserver"
fileSaveName = Application.GetSaveAsFilename( _
* * fileFilter:="Excel Files (*.xls), *.xls")
Workbooks.Add
Set newbook = ActiveWorkbook
newbook.Sheets("Sheet1").Range("A1") = LastRow
ActiveWorkbook.SaveAs _
* *Filename:=fileSaveName, _
* *FileFormat:=xlNormal, _
* *Password:="", _
* *WriteResPassword:="", _
* *ReadOnlyRecommended:=False, _
* *CreateBackup:=False
newbook.Close

End Sub



"Jumparound" wrote:
On 7 apr, 14:54, "Otto Moehrbach"
wrote:
Not sure of what you want. The row number of the last row of, say, Column A,
is:
RowNum=Range("A" & rows.count).end(xlup).row
If you have a header row and you don't want to count it in the number of
rows, you would subtract 1 from the RowNum. *Does this help? *Otto"Jumparound" wrote in message


....


Hello,


first of all, im not a programmer.
I do this to automate an very very boring task @ work.


This is what i do.
I import a text file into excel.
I add our layout to the sheet.
I write down the number of rows.
Then I save it with a new name.


this x 35.


Now, this is what i did in VBA (detail are not that important)


* *Call OpenTextFile001
* *Call Format
* *Call Save001
* *Call Nextfile
* *Call OpenTextFile002
* *Call Format
* *Call Save002
* *Call Nextfile


I made a macro of every step. This way somebody else can open the
macro and edit it with new information when im not at the office.


The only thing i havnt managed to solve is the Number of rows part.
I want to copy the numer of rows to a new workbook for each file I
process.
There is a very specific order in wich the files are processed, so all
I need in a new sheet would be a number.


Could someone help me with a SUB?- Tekst uit oorspronkelijk bericht niet weergeven -


- Tekst uit oorspronkelijk bericht weergeven -


Oke, thats what i want yes :-)
But how do i copy that value to a new workbook?


tnx!- Tekst uit oorspronkelijk bericht niet weergeven -


- Tekst uit oorspronkelijk bericht weergeven -


tnx guys!
I will look into it!
(maybe i wasnt exactely clear on 1 point. i just want to save the
number of rows for the batch i process
i.e.

Textfile001 30
Textfile002 24
Textfile003 112
Textfile004 22

ect. ect.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Search, Count, Match and Post Values vincentws Excel Worksheet Functions 4 August 17th 06 05:20 PM
Can I link a result from Quick Book Pro 2006 to an Excel file? giloboy Excel Discussion (Misc queries) 0 February 20th 06 03:09 PM
Can I link a result from Quick Book Pro 2006 to an Excel file? giloboy Excel Discussion (Misc queries) 0 February 20th 06 03:07 PM
Can I link a result from Quick Book Pro 2006 to an Excel file? giloboy Excel Discussion (Misc queries) 0 February 20th 06 03:05 PM
Wrong result returned by UsedRange.Rows.Count j[_4_] Excel Programming 3 June 20th 05 09:03 PM


All times are GMT +1. The time now is 07:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"