Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
tojo107
 
Posts: n/a
Default Auto Insert Rows of Data??

I get get a spreadsheet each day that gives me orders by day for the year by
Offer #.
If there was no order on a particular day for an offer, it skips that day.
I want to insert the missing day in the correct row and auto insert "0" for
number of orders and $. Ex. -in the data below, there were no orders beetween
12/23 and 12/27. I want to automatically insert rows with the missing date
and "0" for orders and Deamand. Is there function or snippet of code to
help???

Thanks,
Tom


PX05C1A* PX05C2A*
OrderDate Orders Demand Orders Demand
12/23/04 1 $39.00 0 $0.00
12/27/04 4 $214.50 0 $0.00
12/28/04 2 $68.00 0 $0.00
12/29/04 1 $118.00 0 $0.00
12/30/04 10 $799.50 0 $0.00





  #2   Report Post  
Bernie Deitrick
 
Posts: n/a
Default

Tom,

Select the cells with the dates, and then run the macro below.

HTH,
Bernie
MS Excel MVP


Sub TryNow()
Dim mySel As Range
Dim Earliest As Variant
Dim Latest As Variant
Dim Dates As Variant
Dim myCount As Integer

myCount = 0

Set mySel = Selection
Earliest = Application.Min(mySel)
Latest = Application.Max(mySel)
For Dates = Earliest To Latest
If IsError(Application.Match(Dates, mySel, False)) Then
myCount = myCount + 1
With mySel(mySel.Cells.Count + myCount)
.Value = Dates
.NumberFormat = mySel(1).NumberFormat
.Offset(0, 1).Value = 0
.Offset(0, 2).Value = 0
End With
End If
Next Dates
End Sub



"tojo107" wrote in message
...
I get get a spreadsheet each day that gives me orders by day for the year

by
Offer #.
If there was no order on a particular day for an offer, it skips that

day.
I want to insert the missing day in the correct row and auto insert "0"

for
number of orders and $. Ex. -in the data below, there were no orders

beetween
12/23 and 12/27. I want to automatically insert rows with the missing date
and "0" for orders and Deamand. Is there function or snippet of code to
help???

Thanks,
Tom


PX05C1A* PX05C2A*
OrderDate Orders Demand Orders Demand
12/23/04 1 $39.00 0 $0.00
12/27/04 4 $214.50 0 $0.00
12/28/04 2 $68.00 0 $0.00
12/29/04 1 $118.00 0 $0.00
12/30/04 10 $799.50 0 $0.00







  #3   Report Post  
tojo107
 
Posts: n/a
Default

this worked perfectly thank you -you saved me hours a day!!!!

"Bernie Deitrick" wrote:

Tom,

Select the cells with the dates, and then run the macro below.

HTH,
Bernie
MS Excel MVP


Sub TryNow()
Dim mySel As Range
Dim Earliest As Variant
Dim Latest As Variant
Dim Dates As Variant
Dim myCount As Integer

myCount = 0

Set mySel = Selection
Earliest = Application.Min(mySel)
Latest = Application.Max(mySel)
For Dates = Earliest To Latest
If IsError(Application.Match(Dates, mySel, False)) Then
myCount = myCount + 1
With mySel(mySel.Cells.Count + myCount)
.Value = Dates
.NumberFormat = mySel(1).NumberFormat
.Offset(0, 1).Value = 0
.Offset(0, 2).Value = 0
End With
End If
Next Dates
End Sub



"tojo107" wrote in message
...
I get get a spreadsheet each day that gives me orders by day for the year

by
Offer #.
If there was no order on a particular day for an offer, it skips that

day.
I want to insert the missing day in the correct row and auto insert "0"

for
number of orders and $. Ex. -in the data below, there were no orders

beetween
12/23 and 12/27. I want to automatically insert rows with the missing date
and "0" for orders and Deamand. Is there function or snippet of code to
help???

Thanks,
Tom


PX05C1A* PX05C2A*
OrderDate Orders Demand Orders Demand
12/23/04 1 $39.00 0 $0.00
12/27/04 4 $214.50 0 $0.00
12/28/04 2 $68.00 0 $0.00
12/29/04 1 $118.00 0 $0.00
12/30/04 10 $799.50 0 $0.00








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
Pull Current Month's Data Out of List - Repost Karl Burrows Excel Discussion (Misc queries) 4 May 3rd 05 01:06 AM
can't insert more rows even though not at max rows nikkiamber Excel Worksheet Functions 3 April 4th 05 10:45 PM
INSERT ROWS WITHOUT SCREWING-UP FORMULAS! BILL GATES - I WANNA WORD WITH YOU! Excel Worksheet Functions 1 March 4th 05 01:32 PM
Pulling data from 1 sheet to another Dave1155 Excel Worksheet Functions 1 January 12th 05 05:55 PM
how do I insert multiple rows in excel after every row of data grantm5 Excel Discussion (Misc queries) 1 December 14th 04 08:09 PM


All times are GMT +1. The time now is 09:54 AM.

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"