LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Insert new row after a name range

Hi Mike,

Your code is working perfectly, thank you for your help

Catherine

"Mike Fogleman" wrote:

OOPS, I got them reversed,

Try this:

Sub test()
Dim FRow As Integer, LRow As Integer
FRow = Range("Training").Row
LRow = Range("Training").Rows.Count + FRow
Rows(LRow).EntireRow.Insert
Range("A5:B5").Copy
Range("A" & LRow).PasteSpecial Paste:=xlFormats
Range("E5:F5").Copy
Range("E" & LRow).PasteSpecial Paste:=xlFormulas
Application.CutCopyMode = False
End Sub

Mike F

"Mike Fogleman" wrote in message
. ..
Try this:

Sub test()
Dim FRow As Integer, LRow As Integer
FRow = Range("Training").Row
LRow = Range("Training").Rows.Count + FRow
Rows(LRow).EntireRow.Insert
Range("A5:B5").Copy
Range("A" & LRow).PasteSpecial Paste:=xlFormulas
Range("E5:F5").Copy
Range("E" & LRow).PasteSpecial Paste:=xlFormats
Application.CutCopyMode = False
End Sub

Mike F
"catherine" wrote in message
...
Thanks Mike, your code is working but it's copying the contents also.
Can we just copy the validation and the formulas?

"Mike Fogleman" wrote:

Put this code in a module and run with the sheet active.

Sub test()
Dim FRow As Integer, LRow As Integer
FRow = Range("Training").Row
LRow = Range("Training").Rows.Count + FRow
Rows(LRow).EntireRow.Insert
Range("A5:B5").Copy Range("A" & LRow)
Range("E5:F5").Copy Range("E" & LRow)
End Sub

Mike F
"Catherine" wrote in message
...
Hi,

I am new on this site and I don't know really much about VBA, can you
help
me?

I want to copy the validation of he cells A5:B5 and the formulas of
cells
E5:F5 into a new row inserted after the range name "Training".

Thanks








 
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
Insert a Range Steve[_4_] Excel Programming 3 April 1st 08 07:53 AM
Find Last in Range & Insert Karen McKenzie Excel Programming 4 April 9th 07 04:10 PM
Auto insert a range fastballfreddy Excel Discussion (Misc queries) 1 May 9th 06 12:41 AM
Insert...Name Range childofthe1980s Excel Discussion (Misc queries) 1 May 24th 05 03:52 PM
Insert a Range name Pete Excel Programming 1 January 14th 04 04:59 PM


All times are GMT +1. The time now is 06:16 PM.

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"