p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

vba_excel thread: Selecting and using rows in a Excel spreadsheet using VBA


Message #1 by "Robert McClintock" <robert.mcclintock@h...> on Thu, 5 Sep 2002 16:04:04
I would sort it, then use the autofilter and then use
specialcells(xlcellvisible) to copy the each filtered set to a new
worksheet.

|-----Original Message-----
|From: McClintock, Robert - HMS [mailto:Robert.McClintock@h...]
|Sent: Friday, September 06, 2002 2:31 AM
|To: VBA_Excel
|Subject: [vba_excel] Re: Selecting and using rows in a Excel spreadshe
|et using VBA
|
|
|Thats great, I think thats just what I needed to know!  I just
|couldnt get a
|handle on locating a set of rows.
|
|Thanks very much
|
|Robert
|
|-----Original Message-----
|From: Philip Wong [mailto:philipwong37@h...]
|Sent: 05 September 2002 19:03
|To: VBA_Excel
|Subject: [vba_excel] Re: Selecting and using rows in a Excel spreadsheet
|using VBA
|
|
|
|
|
|Hi,
|It will be too details to write here. But what you need is
|definitely can be
|
|done by VBA. Try to explore the "Find" function in VBA. If your data are
|sorted properly, you should able to locate the address of the
|first row and
|last row of that particular category. Get the addresses of the left top
|corner and bottom right corner of your selected category and copy the
|selected range to your targeted worksheet and range.
|
|Just far too complicated to describe here. Try to get a decent Excel VBA
|book. That should help you to develop your skill.
|
|
|Philip
|
|
|>I regularly get a .csv file of data and I need to read it into a
|>spreadsheet.
|>
|>The data is sorted by a type column and I want to cut/past/copy all the
|>rows of a particular type into separate worksheets within the workbook.
|>There is not a fixed position or number of rows for each type,
|>
|>The job, done manually, is:
|>
|>import csv file into excel as a data worksheet
|>sort all rows by type
|>for each row type
|>begin
|>	create new worksheet for row type
|>	copy header row
|>         go to new worksheet
|>	copy header row into row1
|>         go to data worksheet
|>	cut all the rows for the current type
|>         go to new worksheet
|>	paste the copied rows into the new worksheet
|>         go to data worksheet
|>	next row type
|>end
|>
|>the bit that I cant get a handle on is selecting & cutting all the rows
|>for a rowtype.
|>What is the best way of approaching this?
|>
|
|
|
|
|Philip Wong
|
|
|_________________________________________________________________
|Send and receive Hotmail on your mobile device: http://mobile.msn.com
|
|
|
|
|**********************************************************************
|This message (including any attachments) is confidential and may be
|legally privileged.  If you are not the intended recipient, you should
|not disclose, copy or use any part of it - please delete all copies
|immediately and notify the Hays Group Email Helpdesk at
|email.helpdesk@h...
|Any information, statements or opinions contained in this message
|(including any attachments) are given by the author.  They are not
|given on behalf of Hays unless subsequently confirmed by an individual
|other than the author who is duly authorised to represent Hays.
|
|A member of the Hays plc group of companies.
|Hays plc is registered in England and Wales number 2150950.
|Registered Office Hays House Millmead Guildford Surrey GU2 4HJ.
|**********************************************************************
|
|


  Return to Index