#1
|
|||
|
|||
need macro insert blank row(s) under data
I need macro that inserts one or two blank rows under date where will be necessary. for e.x under date must be 2 rows no less no more. as you see under 83570 row is two blank rows, under 83573 one row, under 83575 no one, so I need under date insert 2 rows only. thanks
|
#2
|
||||
|
||||
You have already been give an answer to a very similar question in this thread: https://www.msofficeforums.com/excel...ific-data.html. Please don't expect to be spoon-fed. Study the code you've already got to see what changes you might need to make for this situation. If you get stuck, then post back explaining what problems you're having.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
I think this macro is different, in anyway I am unable to modify macro, I know I have to learn writing macro. simply if you help with this will be glad. thanks
|
#4
|
||||
|
||||
Yes, it is different, but not by much. Compare this macro against the one I've posted in the other thread:
Code:
Sub InsertDateRows() Dim lRow As Long, i As Long With ThisWorkbook.Worksheets("Sheet1").UsedRange For i = .Cells.SpecialCells(xlCellTypeLastCell).Row To 1 Step -1 If IsDate(.Range("B" & i).Text) Then While IsDate(.Range("B" & i + 2).Text) Or IsDate(.Range("B" & i + 1).Text) .Range("B" & i + 1).EntireRow.Insert Wend End If Next End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
this macro did not work
|
#6
|
|||
|
|||
I tried this macro but nothing did
|
#7
|
||||
|
||||
Works for me... What do you actually have in Column B?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#8
|
|||
|
|||
what will be if I send you my file and try yourself ?
|
#9
|
||||
|
||||
You could attach an Excel file to a post, but you haven't even answered the question from my last post.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#10
|
|||
|
|||
B column is date sorry
|
#11
|
|||
|
|||
here is file
here example file
|
#12
|
||||
|
||||
There is something odd about your workbook. Although the dates appear to be in column B, the macro can only access them via references to column A. Perhaps that has something to do with the use of a RTL language. To get the macro to work with your workbook, simply change all the "B" references to "A".
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#13
|
|||
|
|||
I did all as you told me and it works. thank you very much
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
need macro insert row under specific data | gogita_79 | Excel Programming | 2 | 09-15-2014 01:48 AM |
Trying to insert a blank which shows up with background highlighted | livemusic | Word | 3 | 10-29-2012 02:50 PM |
How to Insert a Clear, Blank page without Lines and Numbers in a Pleading Document | Dirigo | Word | 5 | 09-30-2011 08:08 AM |
Sorting or an Excel formula to insert a blank row after ending a series. | PRADEEPB270 | Excel | 1 | 09-07-2011 02:33 AM |
How to organize and insert blank cells between a huge number of data? | tareq | Excel | 12 | 09-29-2010 02:12 PM |