Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a large spread containing historical information that i update
monthly. I am trying to write a macro that will go to the last month updated and insert a row beneath it copying the formulas from above. The date is in column A. Any suggestoins? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub ABC()
Dim rng As Range Set rng = Rows(Cells(Rows.Count, 1).End(xlUp)(2).Row) rng.FillDown On Error Resume Next rng.SpecialCells(xlConstants).ClearContents On Error GoTo 0 End Sub -- Regards, Tom Ogilvy "John" wrote in message ... I have a large spread containing historical information that i update monthly. I am trying to write a macro that will go to the last month updated and insert a row beneath it copying the formulas from above. The date is in column A. Any suggestoins? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tom,
Thanks for the help. I don't think I gave you enough information. The spread sheet contains blank lines. I was hoping the macro would seek out the last date updated in column A and add a line after that. Sorry for the confustion. See below for a condensed example of what the spread sheet looks like Well A Company Name Various Info Various Info May-05 1234 1234 Formula 1234 June-05 1234 1234 Formula 1234 July-05 1234 1234 Formula 1234 "Tom Ogilvy" wrote: Sub ABC() Dim rng As Range Set rng = Rows(Cells(Rows.Count, 1).End(xlUp)(2).Row) rng.FillDown On Error Resume Next rng.SpecialCells(xlConstants).ClearContents On Error GoTo 0 End Sub -- Regards, Tom Ogilvy "John" wrote in message ... I have a large spread containing historical information that i update monthly. I am trying to write a macro that will go to the last month updated and insert a row beneath it copying the formulas from above. The date is in column A. Any suggestoins? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That's what it does assuming the last date updated is the last filled cell
in column A (which is what I understood you to say). -- Regards, Tom Ogilvy "John" wrote in message ... Tom, Thanks for the help. I don't think I gave you enough information. The spread sheet contains blank lines. I was hoping the macro would seek out the last date updated in column A and add a line after that. Sorry for the confustion. See below for a condensed example of what the spread sheet looks like Well A Company Name Various Info Various Info May-05 1234 1234 Formula 1234 June-05 1234 1234 Formula 1234 July-05 1234 1234 Formula 1234 "Tom Ogilvy" wrote: Sub ABC() Dim rng As Range Set rng = Rows(Cells(Rows.Count, 1).End(xlUp)(2).Row) rng.FillDown On Error Resume Next rng.SpecialCells(xlConstants).ClearContents On Error GoTo 0 End Sub -- Regards, Tom Ogilvy "John" wrote in message ... I have a large spread containing historical information that i update monthly. I am trying to write a macro that will go to the last month updated and insert a row beneath it copying the formulas from above. The date is in column A. Any suggestoins? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tom,
Thanks for all the help. Possibly the problem I am having is because there are several wells that i am tracking on one spread sheet. I played around with the spread sheet and got it to add a row like it should for the last well however i need it to add a row for each well. See Below: Well A May Jun Jul Well B May Jun Jul Sorry I didn't explain the problem better. "Tom Ogilvy" wrote: That's what it does assuming the last date updated is the last filled cell in column A (which is what I understood you to say). -- Regards, Tom Ogilvy "John" wrote in message ... Tom, Thanks for the help. I don't think I gave you enough information. The spread sheet contains blank lines. I was hoping the macro would seek out the last date updated in column A and add a line after that. Sorry for the confustion. See below for a condensed example of what the spread sheet looks like Well A Company Name Various Info Various Info May-05 1234 1234 Formula 1234 June-05 1234 1234 Formula 1234 July-05 1234 1234 Formula 1234 "Tom Ogilvy" wrote: Sub ABC() Dim rng As Range Set rng = Rows(Cells(Rows.Count, 1).End(xlUp)(2).Row) rng.FillDown On Error Resume Next rng.SpecialCells(xlConstants).ClearContents On Error GoTo 0 End Sub -- Regards, Tom Ogilvy "John" wrote in message ... I have a large spread containing historical information that i update monthly. I am trying to write a macro that will go to the last month updated and insert a row beneath it copying the formulas from above. The date is in column A. Any suggestoins? |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
John,
You could use a multiple find: Sub Find_Multiple() With Worksheets(1).Range("a1:a500") Set c = .Find("Well", LookIn:=xlValues) If Not c Is Nothing Then firstAddress = c.Address Do MsgBox "Found Well" Set c = .FindNext(c) Loop While Not c Is Nothing And c.Address < firstAddress End If End With End Sub And in each loop you could do the equivalent of Ctrl + DownArrow and Ctrl + DownArrow. Than you want to insert a row and selection.Offset(1,0) You can get the second part of the code using the macro recorder and than modifying the macro to be more general. Post back and let us know if this helps... -- steveB Remove "AYN" from email to respond "John" wrote in message ... Tom, Thanks for all the help. Possibly the problem I am having is because there are several wells that i am tracking on one spread sheet. I played around with the spread sheet and got it to add a row like it should for the last well however i need it to add a row for each well. See Below: Well A May Jun Jul Well B May Jun Jul Sorry I didn't explain the problem better. "Tom Ogilvy" wrote: That's what it does assuming the last date updated is the last filled cell in column A (which is what I understood you to say). -- Regards, Tom Ogilvy "John" wrote in message ... Tom, Thanks for the help. I don't think I gave you enough information. The spread sheet contains blank lines. I was hoping the macro would seek out the last date updated in column A and add a line after that. Sorry for the confustion. See below for a condensed example of what the spread sheet looks like Well A Company Name Various Info Various Info May-05 1234 1234 Formula 1234 June-05 1234 1234 Formula 1234 July-05 1234 1234 Formula 1234 "Tom Ogilvy" wrote: Sub ABC() Dim rng As Range Set rng = Rows(Cells(Rows.Count, 1).End(xlUp)(2).Row) rng.FillDown On Error Resume Next rng.SpecialCells(xlConstants).ClearContents On Error GoTo 0 End Sub -- Regards, Tom Ogilvy "John" wrote in message ... I have a large spread containing historical information that i update monthly. I am trying to write a macro that will go to the last month updated and insert a row beneath it copying the formulas from above. The date is in column A. Any suggestoins? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Not allowing to continu unless a specific cell has specific answer | Excel Discussion (Misc queries) | |||
Link to specific cell in specific Excel file | Excel Discussion (Misc queries) | |||
Link from a specific Cell in Excel to a specific para. in Word | Excel Worksheet Functions | |||
Highlight a row if a specific cell is specific numbers/words | Excel Worksheet Functions | |||
How do I make a cell date specific to input a value on a specific. | Excel Discussion (Misc queries) |