LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 325
Default Filtering a database then copying visible cells based on CurrentRe

Good morning all,

I'm using VBA loop to repeatedly filter a database based on the contents of
a list of cells containing employee names.
Once I filter on a particular name, I end up with (say) a header row and
5-10 rows of data underneath.
I then want to copy the data rows (but not the header row) into another
workbook.
I've been trying to use CurrentRegion, then offsetting this selection by 1
and resizing by the number of rows in the currentselection minus 1 to exclude
the header rows and select the data rows thus:

Set EFCR = Range("A4").CurrentRegion
EFCR.Offset(1, 0).Resize(EFCR.Rows.Count - 1, EFCR.Columns.Count).Copy

The problem I have is that Currentregion includes all the hidden date rows
that have been excluded by the filter, so I can't use it to select my data.
There may be only 10 rows visible, but Currentregion returns the size of the
whole database.

I think I need some combination of CurrentRegion and xlCellTypeVisible to
accomplish what I need, but I'm not sure if this is possible, or, if it is,
what the syntax should be. Otherwise, the alternative is a very nasty
For-Next loop for every crow in the database. Ugly.

Can anyone help, please?

Thanks in advance

Pete


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying visible merged cells rtwiss Excel Discussion (Misc queries) 2 October 1st 08 08:15 PM
Copying and pasting to visible cells only FJ Excel Discussion (Misc queries) 4 November 17th 06 01:01 AM
Copying visible cells only on a protected worksheet Paula Excel Discussion (Misc queries) 0 June 6th 06 05:32 PM
Copying Visible Cells [email protected] Excel Programming 5 November 16th 03 01:50 PM
Help: Copying Visible Cells only to Visible cells! Jay Jayakumar Excel Programming 0 July 9th 03 08:25 PM


All times are GMT +1. The time now is 01:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"