Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Insert Row Below, then Copy and Paste from Named Range

8 views
Skip to first unread message

David Godinger

unread,
Dec 21, 2021, 1:28:29 PM12/21/21
to
I'm attempting VBA that will

1) Insert a row BENEATH the current one

2) Copy a named range into the new row

In the following code, part 1) already works, but part 2) doesn't get me the content or format of the named range. Here's what I've cobbled together so far:

Sub insertRowUpWide()

'1) THIS WORKS: Insert row below
Dim xRg As Range

On Error Resume Next
Set xRg = ActiveCell.Offset(1, 0)
xRg.EntireRow.Select
Selection.Insert Shift:=xlDown
Selection.ClearFormats
Application.ScreenUpdating = True

'2) THIS DOES NOT WORK: Paste from named range
Range("rowToInsertWide").Copy
ActiveSheet.Paste

End Sub

0 new messages