Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default Insert row and copy cells from the currently selected row

New to Excel VBA, but have 10 years programming in Access

I have a row pointer for my worksheet, and a command button on a form that I
want to use to insert a blank row after the currently selected row, and then
copy the data from the first three columns of the currently selected row.
How do I

--
Email address is not valid.
Please reply to newsgroup only.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Insert row and copy cells from the currently selected row

Try following macro:

Sub InsertRow()
ActualRow = Selection.Row
Cells(ActualRow + 1, 1).EntireRow.Insert
Range(Cells(ActualRow, 1), Cells(ActualRow, 3)).Copy _
Destination:=Cells(ActualRow + 1, 1)
End Sub


Regards
reklamo

"Dale Fye" wrote:

New to Excel VBA, but have 10 years programming in Access

I have a row pointer for my worksheet, and a command button on a form that I
want to use to insert a blank row after the currently selected row, and then
copy the data from the first three columns of the currently selected row.
How do I

--
Email address is not valid.
Please reply to newsgroup only.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default Insert row and copy cells from the currently selected row

Worked like a charm,

Thanks.
--
Email address is not valid.
Please reply to newsgroup only.


"reklamo" wrote:

Try following macro:

Sub InsertRow()
ActualRow = Selection.Row
Cells(ActualRow + 1, 1).EntireRow.Insert
Range(Cells(ActualRow, 1), Cells(ActualRow, 3)).Copy _
Destination:=Cells(ActualRow + 1, 1)
End Sub


Regards
reklamo

"Dale Fye" wrote:

New to Excel VBA, but have 10 years programming in Access

I have a row pointer for my worksheet, and a command button on a form that I
want to use to insert a blank row after the currently selected row, and then
copy the data from the first three columns of the currently selected row.
How do I

--
Email address is not valid.
Please reply to newsgroup only.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 304
Default Insert row and copy cells from the currently selected row

Thanks nice, but I have a questions. Can you change the code to start at cell
D34 and also copy the format in row 33?

"reklamo" wrote:

Try following macro:

Sub InsertRow()
ActualRow = Selection.Row
Cells(ActualRow + 1, 1).EntireRow.Insert
Range(Cells(ActualRow, 1), Cells(ActualRow, 3)).Copy _
Destination:=Cells(ActualRow + 1, 1)
End Sub


Regards
reklamo

"Dale Fye" wrote:

New to Excel VBA, but have 10 years programming in Access

I have a row pointer for my worksheet, and a command button on a form that I
want to use to insert a blank row after the currently selected row, and then
copy the data from the first three columns of the currently selected row.
How do I

--
Email address is not valid.
Please reply to newsgroup only.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Insert row and copy cells from the currently selected row

You can try this Dale

Sub test()
With Cells(ActiveCell.Row, 1)
.Offset(1, 0).EntireRow.Insert
.Offset(1, 0).Resize(1, 3).Value = .Resize(1, 3).Value
End With
End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Dale Fye" wrote in message ...
New to Excel VBA, but have 10 years programming in Access

I have a row pointer for my worksheet, and a command button on a form that I
want to use to insert a blank row after the currently selected row, and then
copy the data from the first three columns of the currently selected row.
How do I

--
Email address is not valid.
Please reply to newsgroup only.



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
Cannot copy selected cells Stevie Excel Discussion (Misc queries) 1 February 19th 10 06:06 PM
Copy and paste versus copy and insert copied cells Alana New Users to Excel 1 September 28th 07 08:58 PM
Copy selected cells [email protected] Excel Programming 3 March 23rd 07 02:35 PM
How can I copy the values of all selected cells to the same cells inanother Sheet [email protected] Excel Programming 2 August 8th 06 05:45 PM
Copy Selected cells down a row with macro DB33 Excel Discussion (Misc queries) 1 February 15th 06 05:33 PM


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