Results 1 to 4 of 4

Grouping a pasted range

Threaded View

  1. #1
    Forum Contributor KBSH's Avatar
    Join Date
    09-16-2015
    Location
    Netherlands
    MS-Off Ver
    2013
    Posts
    113

    Grouping a pasted range

    Hello

    I'm trying to copy and paste a certain range that needs to be pasted as a group. I've tried several things, but somehow it doesn't group the rows but the columns instead.
    The code I'm using is:

     Public Sub NIEUWE_RUIMTE()
        Application.ScreenUpdating = False
        Dim Startrng     As Range
        Dim Endrng       As Range
            Rows.Hidden = False
            Rows("3:6").Copy
        ActiveSheet.Shapes(Application.Caller).TopLeftCell.Offset(0, -1).Select
            Do While ActiveCell.Value = "X"
                 ActiveCell.Offset(1, 0).Select
            Loop
        Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
        Set Startrng = ActiveCell.Offset(1, 0)
        Set Endrng = Startrng.Offset(2, 0)
        
        Range(Startrng, Endrng).Group
        
        Application.CutCopyMode = False
        ActiveSheet.Outline.ShowLevels RowLevels:=1
            Rows("2:7").EntireRow.Hidden = True
    End Sub
    It would be nice if someone could target my problem.
    Attached Files Attached Files
    Last edited by KBSH; 03-06-2017 at 09:55 AM.
    I'm mediocre with VBA, but getting there

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Reference Range just pasted in.
    By WickedxJosh in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-31-2014, 02:50 PM
  2. dynamic range as string to be pasted not pasting
    By devil20a in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 07-08-2013, 03:07 PM
  3. Use VBA to Validate data entered or pasted into a range
    By stanlelma in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-27-2013, 05:47 AM
  4. transpose a selected range and have the Link pasted
    By d888nc in forum Excel General
    Replies: 1
    Last Post: 11-10-2006, 03:08 AM
  5. Replies: 3
    Last Post: 08-11-2006, 09:10 AM
  6. [SOLVED] How do I determine the Range that was pasted
    By Mike in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-30-2006, 08:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1