Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi! I have a workbook that is basically a database. On each sheet there is a
list of dates in column A. the rest of the columns have values corresponding to that date. Now sometimes there is a date missing. If I want to add data to that date I must insert a new row in every worksheet. Is there some way I can use a macro to insert the row? Assume I want to insert 2007-02-03. I would then search column A in every sheet for the date before ie 2007-02-02 and if I could not find that I would search for 2007-02-01. Once found I would insert a row. Is this possible? any help appreciated! thanks! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Arne,
You could do that but a far simpler solution would be to put your new data on the last row and sort by column A which you could do with a macro if you have lots of sheets. Mike "Arne Hegefors" wrote: Hi! I have a workbook that is basically a database. On each sheet there is a list of dates in column A. the rest of the columns have values corresponding to that date. Now sometimes there is a date missing. If I want to add data to that date I must insert a new row in every worksheet. Is there some way I can use a macro to insert the row? Assume I want to insert 2007-02-03. I would then search column A in every sheet for the date before ie 2007-02-02 and if I could not find that I would search for 2007-02-01. Once found I would insert a row. Is this possible? any help appreciated! thanks! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub add_date()
NewDate = DateValue("1/28/2007") For Each sht In ThisWorkbook.Sheets Set c = sht.Columns("A:A").Find(what:=NewDate, _ LookIn:=xlValues) If c Is Nothing Then RowCount = 1 Do While sht.Range("A" & RowCount) < NewDate And _ sht.Range("A" & RowCount) < "" RowCount = RowCount + 1 Loop sht.Rows(RowCount).Insert If RowCount = 1 Then sht.Range("A1") = NewDate Else sht.Range("A" & (RowCount)) = NewDate End If End If Next sht End Sub "Mike H" wrote: Arne, You could do that but a far simpler solution would be to put your new data on the last row and sort by column A which you could do with a macro if you have lots of sheets. Mike "Arne Hegefors" wrote: Hi! I have a workbook that is basically a database. On each sheet there is a list of dates in column A. the rest of the columns have values corresponding to that date. Now sometimes there is a date missing. If I want to add data to that date I must insert a new row in every worksheet. Is there some way I can use a macro to insert the row? Assume I want to insert 2007-02-03. I would then search column A in every sheet for the date before ie 2007-02-02 and if I could not find that I would search for 2007-02-01. Once found I would insert a row. Is this possible? any help appreciated! thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
insert rows in multi sheets | Excel Programming | |||
How do you insert rows into multiple sheets in a workbook? | Excel Discussion (Misc queries) | |||
insert Rows with Formulas in Place on Multiple Sheets? | Excel Discussion (Misc queries) | |||
Links between sheets in error due to insert rows | Excel Discussion (Misc queries) | |||
Insert rows on multiple sheets | Excel Programming |