Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Add Row after a Specific Cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Add Row after a Specific Cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Add Row after a Specific Cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Add Row after a Specific Cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Add Row after a Specific Cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default Add Row after a Specific Cell

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
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
Not allowing to continu unless a specific cell has specific answer madubois9 Excel Discussion (Misc queries) 3 October 25th 07 12:45 AM
Link to specific cell in specific Excel file JeroenM Excel Discussion (Misc queries) 3 July 6th 07 10:08 AM
Link from a specific Cell in Excel to a specific para. in Word CathyK Excel Worksheet Functions 0 August 10th 06 04:40 PM
Highlight a row if a specific cell is specific numbers/words sea0221 Excel Worksheet Functions 2 March 9th 05 12:06 AM
How do I make a cell date specific to input a value on a specific. ebuzz13 Excel Discussion (Misc queries) 1 January 18th 05 05:53 PM


All times are GMT +1. The time now is 06:45 AM.

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"