Wrox Programmer Forums
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 14th, 2004, 04:29 AM
Registered User
Join Date: Oct 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default copying an excel list

i have a list of data which contains hidden rows when i go to copy the visble list over to another spreadsheet it unhides all the columns. is there a way of stopping this happen so that i can copy only the visible columns accross. :)

Old October 14th, 2004, 07:15 AM
Authorized User
Join Date: Feb 2004
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts

Hi Ballian

Here is an example on how it can be done.

Sub CopyUnhidden()
    Dim J, TargetRow As Integer
    TargetRow = 1
    For J = 1 To 20
        If Not Sheet1.Rows(J).Hidden Then
            Sheet2.Cells(TargetRow, 1).Value = Sheet1.Cells(J, 1).Value
            TargetRow = TargetRow + 1
        End If
     Next J
End Sub

Old October 15th, 2004, 02:54 AM
Authorized User
Join Date: Aug 2004
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts

Something like this ... ?
Dim CopyRange As Range
Set CopyRange = ActiveSheet.Range("A1:F2000").SpecialCells(xlCellTypeVisible)
ThisWorkbook.Worksheets("Sheet1").Paste Destination:=Worksheets("Sheet1").Range("A1")
Regards BrianB
Most problems occur from starting at the wrong place.
Use a cup of coffee to make Windows run faster.
It is easy until you know how.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with cloning or copying a list GS C# 2005 1 May 23rd, 2007 11:32 PM
How to get a list of macros in an Excel sheet tiyyob Excel VBA 0 January 21st, 2006 06:59 PM
Copying Excel Graphs into PPT presentation malocher Beginning VB 6 0 March 28th, 2005 11:21 AM
Copying Multiple Rows in MS Excel 2K using VB .Net Azhar Akbari Excel VBA 2 January 27th, 2005 10:04 AM
Copying controls from Excel Sheet gaurav0508 Excel VBA 3 June 27th, 2004 02:15 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.