• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Copy and paste macro that ignores hidden columns

Jediantman

New Member
So I'm getting very frustrated with a macro I created which basically opens 14 individual sheets copies a selected range of data then pastes it to another. All was fine and working without problems until I had to include some hidden columns into the source data, which are also replicated in the destination. The problem I have is that on 2 out of the 14 source files when the range of cells to copy is selected it ignores the hidden columns so when it pastes it puts everything in the wrong place. The real frustration comes from the fact that the code I'm using is identical, all that changes is the file names.

The code that works is below:

[pre]
Code:
Workbooks.Open Filename:= _
"T:Aidan Spr2013 Tracker.xlsx" _
, ReadOnly:=True, Notify:=False
Sheets("Section 5").Select
Range("A23:CH130").Select
Selection.Copy
Windows("SPR13_Datamastermacro.xlsm").Activate
Sheets("Section5Master").Select
Range("A23").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=213
Range("A134").Select
The code that doesn't work properly:

Workbooks.Open Filename:= _
"T:Lewis Spr2013 Tracker.xlsx" _
, ReadOnly:=True, Notify:=False
Application.DisplayAlerts = True
Sheets("Section 5").Select
Range("A23:CH130").Select
Selection.Copy
Windows("SPR13_Datamastermacro.xlsm").Activate
Sheets("Section5Master").Select
Range("A689").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=231
Range("A790").Select
[/pre]
Any ideas are welcomed before I suffer an embolism...
 
Very frustrating. Here's a few tweaks, not sure if it'll make a difference:

[pre]
Code:
Workbooks.Open Filename:= _
"T:Aidan Spr2013 Tracker.xlsx" _
, ReadOnly:=True, Notify:=False
Sheets("Section 5").Range("A23:CH130").Copy
Windows("SPR13_Datamastermacro.xlsm").Activate
Sheets("Section5Master").Range("A23").PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Sheets("Section5Master").Range("A134").Select
[/pre]
 
Hi, Jediantman!

Any other code in "Lewis Spr2013 Tracker.xlsx" open or worksheets activation events, at "SPR13_Datamastermacro.xlsm" activation events, at "SPR13_Datamastermacro.xlsm" workbook for activate event?

These are blind shots since it's hard to analyze it without the sample files.

Regards!
 
Hi Jediantman,


One blink Shot from my side also.. :)

[pre]
Code:
Workbooks.Open Filename:= _
"T:Lewis Spr2013 Tracker.xlsx" _
, ReadOnly:=True, Notify:=False
Application.DisplayAlerts = True
Sheets("Section 5").Select
'---------
Range("A23:CH130").SpecialCells(xlCellTypeVisible).Select
'---------
Selection.Copy
Windows("SPR13_Datamastermacro.xlsm").Activate
Sheets("Section5Master").Select
Range("A689").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=231
Range("A790").Select
[/pre]

Regards,

Deb
 
Thanks for your help guys. I'm going to have a little play with your suggestions and see if it will work. I can't really provide the sample files as the data I'm dealing with is confidential and I haven't the time to remove the data based on the amount I'm dealing with.
 
Back
Top