#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 91
Default add blank rows

Hi
I have 3 columns contains date 4 example below(left) ,but with missing
dates, would you please help me how can i add row or cell blank between them
and get right columns
col1 col2 col3 col1 col2
col3
1 10 01 1961 1 10 11 1961
2 11 01 1961 2 11 11 1961
3 14 01 1961 3
4 18 01 1961 4
5 05 02 1961 5 14 11 1961
6
7
8
9 18 11
1961

thank's
best regards
raymon
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default add blank rows

Public Sub ProcessData()
Dim i As Long
Dim iLastRow As Long
Dim dte1 As Date
Dim dte2 As Date

With ActiveSheet

iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = iLastRow - 1 To 1 Step -1
dte1 = DateSerial(Cells(i, "C").Value, _
Cells(i, "B").Value, Cells(i, "A").Value)
dte2 = DateSerial(Cells(i + 1, "C").Value, _
Cells(i + 1, "B").Value, Cells(i + 1, "A").Value)
If dte2 - dte1 1 Then
Rows(i + 1).Resize(dte2 - dte1 - 1).Insert
End If
Next i
End With

End Sub


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"climate" wrote in message
...
Hi
I have 3 columns contains date 4 example below(left) ,but with missing
dates, would you please help me how can i add row or cell blank between
them
and get right columns
col1 col2 col3 col1 col2
col3
1 10 01 1961 1 10 11
1961
2 11 01 1961 2 11 11
1961
3 14 01 1961 3
4 18 01 1961 4
5 05 02 1961 5 14 11
1961
6
7
8
9 18
11
1961

thank's
best regards
raymon



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 91
Default add blank rows



"Bob Phillips" wrote:

Public Sub ProcessData()
Dim i As Long
Dim iLastRow As Long
Dim dte1 As Date
Dim dte2 As Date

With ActiveSheet

iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = iLastRow - 1 To 1 Step -1
dte1 = DateSerial(Cells(i, "C").Value, _
Cells(i, "B").Value, Cells(i, "A").Value)
dte2 = DateSerial(Cells(i + 1, "C").Value, _
Cells(i + 1, "B").Value, Cells(i + 1, "A").Value)
If dte2 - dte1 1 Then
Rows(i + 1).Resize(dte2 - dte1 - 1).Insert
End If
Next i
End With

End Sub


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"climate" wrote in message
...
Hi
I have 3 columns contains date 4 example below(left) ,but with missing
dates, would you please help me how can i add row or cell blank between
them
and get right columns
col1 col2 col3 col1 col2
col3
1 10 01 1961 1 10 11
1961
2 11 01 1961 2 11 11
1961
3 14 01 1961 3
4 18 01 1961 4
5 05 02 1961 5 14 11
1961
6
7
8
9 18
11
1961

thank's
best regards
raymon


your response is excellent

thank you bob

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
How do I delete blank rows (rows alternate data, blank, data, etc ncochrax Excel Discussion (Misc queries) 2 June 27th 07 04:40 AM
Copy rows of data (eliminating blank rows) from fixed layout Sweepea Excel Discussion (Misc queries) 1 March 13th 07 11:05 PM
How do I insert blank rows between rows in completed worksheet? bblue1978 Excel Discussion (Misc queries) 1 October 26th 06 07:02 PM
Get number of rows that data uses, including blank rows Denham Coote Excel Discussion (Misc queries) 5 August 22nd 06 02:10 PM
Get number of rows that data takes up, including blank rows Denham Coote Excel Worksheet Functions 2 August 21st 06 09:18 AM


All times are GMT +1. The time now is 08:11 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"