ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to copy cell values to row below (https://www.excelbanter.com/excel-programming/349097-macro-copy-cell-values-row-below.html)

Scott Wagner

Macro to copy cell values to row below
 
I've posted twice for help on a project I'm working on and have had no
replies, guessing that I am asking for too much. Thought I would break this
down into smaller parts.

I have a product listing that includes a summary line (marking, qty, item
number) and multiple detail lines below. I want to change the first values
in the two cells following the summay line and replace with the same
information from the summary line. Ideally I only want to do this if the
item number field contains a specific keyword "Panelboard".

Any ideas?

Thanks,

Scott

Here is a link to my last post if you would like to see where this is
ultimately leading. If this isn't possible please let me know.

http://www.microsoft.com/office/comm...640&sloc=en-us



Tom Ogilvy

Macro to copy cell values to row below
 
Sub AddData()
Dim rng As Range, fAddr As String
Set rng = Columns(3).Find(What:="Panelboard", _
After:=Range("C1"), LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
fAddr = rng.Address
Do
rng.Offset(1, 0).Resize(2, 1).EntireRow.Insert
rng.Offset(1, -2).Resize(2, 2).Value = rng.Offset(0, -2).Resize(1,
2).Value
rng.Offset(1, 0).Value = "Black Box"
rng.Offset(2, 0).Value = "Trim"
Set rng = Columns(3).FindNext(rng)
Loop While rng.Address < fAddr
End If
End Sub


--
Regards,
Tom Ogilvy


"Scott Wagner" wrote in message
...
I've posted twice for help on a project I'm working on and have had no
replies, guessing that I am asking for too much. Thought I would break

this
down into smaller parts.

I have a product listing that includes a summary line (marking, qty, item
number) and multiple detail lines below. I want to change the first

values
in the two cells following the summay line and replace with the same
information from the summary line. Ideally I only want to do this if the
item number field contains a specific keyword "Panelboard".

Any ideas?

Thanks,

Scott

Here is a link to my last post if you would like to see where this is
ultimately leading. If this isn't possible please let me know.


http://www.microsoft.com/office/comm...640&sloc=en-us





Scott Wagner

Macro to copy cell values to row below
 
Tom,

You are a stud!

Thank you very much!

Happy New Year

Scott

"Tom Ogilvy" wrote:

Sub AddData()
Dim rng As Range, fAddr As String
Set rng = Columns(3).Find(What:="Panelboard", _
After:=Range("C1"), LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
fAddr = rng.Address
Do
rng.Offset(1, 0).Resize(2, 1).EntireRow.Insert
rng.Offset(1, -2).Resize(2, 2).Value = rng.Offset(0, -2).Resize(1,
2).Value
rng.Offset(1, 0).Value = "Black Box"
rng.Offset(2, 0).Value = "Trim"
Set rng = Columns(3).FindNext(rng)
Loop While rng.Address < fAddr
End If
End Sub


--
Regards,
Tom Ogilvy


"Scott Wagner" wrote in message
...
I've posted twice for help on a project I'm working on and have had no
replies, guessing that I am asking for too much. Thought I would break

this
down into smaller parts.

I have a product listing that includes a summary line (marking, qty, item
number) and multiple detail lines below. I want to change the first

values
in the two cells following the summay line and replace with the same
information from the summary line. Ideally I only want to do this if the
item number field contains a specific keyword "Panelboard".

Any ideas?

Thanks,

Scott

Here is a link to my last post if you would like to see where this is
ultimately leading. If this isn't possible please let me know.


http://www.microsoft.com/office/comm...640&sloc=en-us







All times are GMT +1. The time now is 04:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com