Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Insert number of rows based on cell value, and fill

I have an Excel database of animal behaviors that shows a count of the
times a given behavior has been observed for a given date . I need to
expand that out into separate entries for each observation;

e.g., date column: 2/14/08; behavior column: feeding; count column
(#observations): 50
for these 50 observations of feeding on 2/14/04, i need 50 rows that
say feeding, instead of 1 row with a count of 50. I need all the info
copied into the new rows.

This is similar to the previous question at
http://www.experts-exchange.com/Soft..._23031740.html.
However, I tried to copy the code and adapt it to my file and it
didn't run. Any help would be greatly appreciated!
  #2   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 390
Default Insert number of rows based on cell value, and fill

Hi Tara,

You can use ADO with XML to perform such task.


Sample Code:
Dim rst as adodb.recordset
Dim Filestream as adodb.stream

set rst= New Adodb.recordset

'append fields
rst.append '<field Name',datatype
:
:
rst.update
rst.open ,adodynamic,adlockoptimistic

'Now loop the values
Dim Data as varient
Dim counter as long

Data= worksheet.range("<Your Range Value")

for i=1 to 65536

for counter=1 to Data
rst.addnew
rst.field("value")= <Your value
next

next
rst.update
rst.save filestrem,adxml
filestream.saveto <path,adcreateoverwrite
filestream.close
rs.close
set rs=nothing

'NOW OPEN SAVED XML FILE
set rst= new adodb.recordset
rst.open path,"Provider=MSPersist"
Range("<your worksheet target").copyrecordset rst
rst.close
set rst=nothing

This will solve your purpose











" wrote:

I have an Excel database of animal behaviors that shows a count of the
times a given behavior has been observed for a given date . I need to
expand that out into separate entries for each observation;

e.g., date column: 2/14/08; behavior column: feeding; count column
(#observations): 50
for these 50 observations of feeding on 2/14/04, i need 50 rows that
say feeding, instead of 1 row with a count of 50. I need all the info
copied into the new rows.

This is similar to the previous question at
http://www.experts-exchange.com/Soft..._23031740.html.
However, I tried to copy the code and adapt it to my file and it
didn't run. Any help would be greatly appreciated!

Reply
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
auto fill rows with months based on cell value Drew[_2_] Excel Discussion (Misc queries) 5 March 31st 08 08:40 AM
Insert a number rows according to a cell value Ed Peters Excel Programming 5 February 14th 08 02:57 PM
Insert a number of rows based on a value in a cell on active row iRocco Excel Programming 3 August 17th 05 12:34 AM
Insert a number of rows based on a value in a cell on active row iRocco Excel Discussion (Misc queries) 1 August 11th 05 06:18 AM
Insert a number of rows based on a value in a cell on active row iRocco Excel Worksheet Functions 0 August 10th 05 08:46 PM


All times are GMT +1. The time now is 10:28 PM.

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

About Us

"It's about Microsoft Excel"