LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #12   Report Post  
Posted to microsoft.public.excel.programming
KDJ KDJ is offline
external usenet poster
 
Posts: 19
Default Inserting lines according to number of days, adjusting date

Thank you, Stopher!!!!

I have been on vacation ... sorry for the late reply. I will test it asap
and let you know how it went. I appreciate it very, very much!!!!

KDJ


"Stopher" wrote:

Made a mistake, this

Cells(Cref, 0).Select

should be

Cells(Cref, 1).Select

so..

Sub InsertRows()
Dim Startdate As Date
Dim EndDate As Date
Dim Gap
Dim Prow As Integer
Dim Cref As Integer

Sheets("Sheet1").Select
Range("A1").Select
Cref = 1

Do Until ActiveCell.Value = ""
Startdate = ActiveCell.Value
ActiveCell.Offset(0, 1).Activate
EndDate = ActiveCell.Value
Gap = EndDate - Startdate

For i = 0 To Gap
Let Prow = Prow + 1
Sheets("Sheet2").Cells(Prow, 1) = Startdate
Sheets("Sheet2").Cells(Prow, 2) = Startdate
Sheets("Sheet2").Cells(Prow, 3) = ActiveCell.Offset(0,
1).Value
Sheets("Sheet2").Cells(Prow, 4) = ActiveCell.Offset(0,
2).Value
Startdate = Startdate + 1
Next
Cref = Cref + 1
Cells(Cref, 1).Select
Loop
End Sub


 
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
Keeping row number after inserting lines MurrayBarn Excel Worksheet Functions 4 June 15th 09 04:17 PM
Inserting new lines with corresponding number tripflex Excel Discussion (Misc queries) 1 March 9th 09 03:28 PM
inserting new lines with number tripflex Excel Discussion (Misc queries) 2 March 6th 09 10:10 PM
inserting rows without adjusting formula relationships Daiv Excel Discussion (Misc queries) 1 August 2nd 06 11:30 PM
2 questions - one about inserting the date, other about adding lines. FAJITA New Users to Excel 7 July 16th 06 12:52 PM


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

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"