Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Macro to copy and paste row

Hi,

I am trying to create a macro that will copy the row (from B:Q) my
active cell is in and paste the content into a newly inserted row
below my active cell. Also, I would like it to copy the formulas that
are in the row and paste them as formulas in the new row. Except for
columns F and G I would prefer the formulas are pasted as values
instead.Is this possible?

I would appreciate your help as my knowledge in VB is very basic.

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Macro to copy and paste row

This first inserts the new blank row below the ActiveCell and yjrm does the
pastes

Sub Macro1()
ActiveCell.Offset(1, 0).EntireRow.Insert
n = ActiveCell.Row
Set r1 = Range("B" & n & ":Q" & n)
Set r2 = Range("B" & n + 1)
r1.Copy r2

Set r3 = Range("F" & n & ":G" & n)
Set r4 = Range("F" & n + 1)
r3.Copy
r4.PasteSpecial Paste:=xlPasteValues
End Sub
--
Gary''s Student - gsnu2007k


" wrote:

Hi,

I am trying to create a macro that will copy the row (from B:Q) my
active cell is in and paste the content into a newly inserted row
below my active cell. Also, I would like it to copy the formulas that
are in the row and paste them as formulas in the new row. Except for
columns F and G I would prefer the formulas are pasted as values
instead.Is this possible?

I would appreciate your help as my knowledge in VB is very basic.

Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Macro to copy and paste row

One way

Sub copyrowdown()
mr = ActiveCell.Row
With Cells(ActiveCell.Row, "b")
.Resize(1, 16).Copy
.Resize(1).Insert shift:=xlDown
.Offset(, 4).Resize(1, 2).Value = _
.Offset(, 4).Resize(1, 2).Value
End With
Application.CutCopyMode = False
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

wrote in message
...
Hi,

I am trying to create a macro that will copy the row (from B:Q) my
active cell is in and paste the content into a newly inserted row
below my active cell. Also, I would like it to copy the formulas that
are in the row and paste them as formulas in the new row. Except for
columns F and G I would prefer the formulas are pasted as values
instead.Is this possible?

I would appreciate your help as my knowledge in VB is very basic.

Thanks!


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Macro to copy and paste row

On Jan 5, 12:49*am, "Don Guillett" wrote:
or change the second resize to get value from ABOVE.
* .Offset(, 4).Resize(1, 2).Value = _
* .Offset(, 4).Resize(0, 2).Value

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Don Guillett" wrote in message

...

One way


Sub copyrowdown()
mr = ActiveCell.Row
With Cells(ActiveCell.Row, "b")
*.Resize(1, 16).Copy
*.Resize(1).Insert shift:=xlDown
*.Offset(, 4).Resize(1, 2).Value = _
*.Offset(, 4).Resize(1, 2).Value
End With
Application.CutCopyMode = False
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

wrote in message
....
Hi,


I am trying to create a macro that will copy the row (from B:Q) my
active cell is in and paste the content into a newly inserted row
below my active cell. Also, I would like it to copy the formulas that
are in the row and paste them as formulas in the new row. Except for
columns F and G I would prefer the formulas are pasted as values
instead.Is this possible?


I would appreciate your help as my knowledge in VB is very basic.


Thanks!


Thanks the macros worked! You are lifesavers!
Just one more question if I change the macro that it copies the rows
from columns A:Q, is it possible to have the macro delete any content
it copies from column A if it did copy any?

That would be a nice added functionality!


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Macro to copy and paste row

Why copy it and then delete it?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

wrote in message
...
On Jan 5, 12:49 am, "Don Guillett" wrote:
or change the second resize to get value from ABOVE.
.Offset(, 4).Resize(1, 2).Value = _
.Offset(, 4).Resize(0, 2).Value

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Don Guillett" wrote in
message

...

One way


Sub copyrowdown()
mr = ActiveCell.Row
With Cells(ActiveCell.Row, "b")
.Resize(1, 16).Copy
.Resize(1).Insert shift:=xlDown
.Offset(, 4).Resize(1, 2).Value = _
.Offset(, 4).Resize(1, 2).Value
End With
Application.CutCopyMode = False
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

wrote in message
...
Hi,


I am trying to create a macro that will copy the row (from B:Q) my
active cell is in and paste the content into a newly inserted row
below my active cell. Also, I would like it to copy the formulas that
are in the row and paste them as formulas in the new row. Except for
columns F and G I would prefer the formulas are pasted as values
instead.Is this possible?


I would appreciate your help as my knowledge in VB is very basic.


Thanks!


Thanks the macros worked! You are lifesavers!
Just one more question if I change the macro that it copies the rows
from columns A:Q, is it possible to have the macro delete any content
it copies from column A if it did copy any?

That would be a nice added functionality!

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Macro to copy and paste row

On Jan 6, 1:33*am, "Don Guillett" wrote:
Why copy it and then delete it?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
wrote in message

...
On Jan 5, 12:49 am, "Don Guillett" wrote:



or change the second resize to get value from ABOVE.
.Offset(, 4).Resize(1, 2).Value = _
.Offset(, 4).Resize(0, 2).Value


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Don Guillett" wrote in
message


...


One way


Sub copyrowdown()
mr = ActiveCell.Row
With Cells(ActiveCell.Row, "b")
.Resize(1, 16).Copy
.Resize(1).Insert shift:=xlDown
.Offset(, 4).Resize(1, 2).Value = _
.Offset(, 4).Resize(1, 2).Value
End With
Application.CutCopyMode = False
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

wrote in message
....
Hi,


I am trying to create a macro that will copy the row (from B:Q) my
active cell is in and paste the content into a newly inserted row
below my active cell. Also, I would like it to copy the formulas that
are in the row and paste them as formulas in the new row. Except for
columns F and G I would prefer the formulas are pasted as values
instead.Is this possible?


I would appreciate your help as my knowledge in VB is very basic.


Thanks!


Thanks the macros worked! You are lifesavers!
Just one more question if I change the macro that it copies the rows
from columns A:Q, is it possible to have the macro delete any content
it copies from column A if it did copy any?

That would be a nice added functionality!


Hi Don,

You are right!
It is unnecessary to do this fro column A as if the row is inserted it
does not automatically copy any information into column A.
What I really need is that the content in column O is not copied as
the user will need to enter information here manually. Is this
possible?

Thanks again!
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
Macro to copy and paste values (columns)I have a macro file built C02C04 Excel Programming 2 May 2nd 08 01:51 PM
copy multiple worksheets of a workbook, and paste onto a Word document ( either create new doc file or paste onto an existing file.) I need this done by VBA, Excel Macro Steven Excel Programming 1 October 17th 05 08:56 AM
Copy and Paste macro needs to paste to a changing cell reference loulou Excel Programming 0 February 24th 05 10:29 AM
how to count/sum by function/macro to get the number of record to do copy/paste in macro tango Excel Programming 1 October 15th 04 01:16 PM
Macro to Copy/Paste then Paste to Next Line tomkarakowski Excel Programming 1 May 28th 04 01:19 AM


All times are GMT +1. The time now is 02:12 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"