Copy Paste - Grouped Columns

SDave

Board Regular
Joined
Aug 12, 2008
Messages
152
Office Version
  1. 365
Platform
  1. MacOS
Bit of an odd question, I have the following code which copies data from various sheets, and pastes it into another workbook.

Code:
Sub CreateCapture()
    Dim ws As Worksheet
    Application.ScreenUpdating = False
    Workbooks.Open Filename:="C:\Users\Joe Bloggs\Desktop\RTT\Admin\Capture.xls"
         
    Windows("Cotswolds.xls").Activate
    With Worksheets("People_Data").Select
    Range("C12:V12", Range("C" & Rows.Count).End(xlUp)).Select
    Application.CutCopyMode = False
    Selection.Copy
    Windows("Capture.xls").Activate
    Sheets("People_Data").Select
    Range("C12").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
    
    End With
    
    Windows("Cotswolds.xls").Activate
    With Worksheets("Successors_for_Roles").Select
    Range("C12:P12", Range("C" & Rows.Count).End(xlUp)).Select
    Application.CutCopyMode = False
    Selection.Copy
    Windows("Capture.xls").Activate
    Sheets("Successors_for_Roles").Select
    Range("C12").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
    
    Sheets("People_Data").Select
    Range("C12").Select
    
    End With
    
    Application.Dialogs(xlDialogSaveAs).Show
    
    If Err = cdlCancel Then
    ActiveWorkbook.Close SaveChanges:=False
    Exit Sub
    End If
    Application.ScreenUpdating = True
End Sub

What I'm finding is that the data that resides in the grouped columns (i.e. Data > Group) isn't being copied (it only occurs when the grouped columns are closed)?!

Is there any way to resolve the issue without having to open the grouped columns before copying the required data set?
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Watch MrExcel Video

Forum statistics

Threads
1,133,158
Messages
5,657,160
Members
418,363
Latest member
Debating_Earth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top