Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Copying data with a macro using autofilter

I set up a few columns of data with an autofilter. The user selects only 1
row at a time with the auto filter. I want to set up a macro to copy this
row to another area of the worksheet for graphing. When All is selected by
the filter, the first record is row 5. I can set up a macro to copy row 5 to
another location for graphing. However, when a user selects any other row,
row 5 of the spreadsheet is now replaced by that row and the macro does not
work. Is there a way to determine what row the user selects by a filter, and
copy that row to another area of the spreadsheet ?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Copying data with a macro using autofilter

Study this code for insights:

http://www.rondebruin.nl/copy5.htm


--
Regards,
Tom Ogilvy


"rmcompute" wrote:

I set up a few columns of data with an autofilter. The user selects only 1
row at a time with the auto filter. I want to set up a macro to copy this
row to another area of the worksheet for graphing. When All is selected by
the filter, the first record is row 5. I can set up a macro to copy row 5 to
another location for graphing. However, when a user selects any other row,
row 5 of the spreadsheet is now replaced by that row and the macro does not
work. Is there a way to determine what row the user selects by a filter, and
copy that row to another area of the spreadsheet ?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Copying data with a macro using autofilter

On additional bit, if you copy the entire range of data that has a filter
applied, only the visible rows are copied. This is the default behavior.

If you step down one row so the header is not included, then you only will
copy your single row.

ActiveSheet.AutFilter.Range includes the header

With ActiveSheet.Autofilter.Range
set r = .offset(1,0).Resize(.rows.count-1)
End with

r should be your row.

--
Regards,
Tom Ogilvy


"rmcompute" wrote:

I set up a few columns of data with an autofilter. The user selects only 1
row at a time with the auto filter. I want to set up a macro to copy this
row to another area of the worksheet for graphing. When All is selected by
the filter, the first record is row 5. I can set up a macro to copy row 5 to
another location for graphing. However, when a user selects any other row,
row 5 of the spreadsheet is now replaced by that row and the macro does not
work. Is there a way to determine what row the user selects by a filter, and
copy that row to another area of the spreadsheet ?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Copying data with a macro using autofilter

It worked. Thank you.

"Tom Ogilvy" wrote:

On additional bit, if you copy the entire range of data that has a filter
applied, only the visible rows are copied. This is the default behavior.

If you step down one row so the header is not included, then you only will
copy your single row.

ActiveSheet.AutFilter.Range includes the header

With ActiveSheet.Autofilter.Range
set r = .offset(1,0).Resize(.rows.count-1)
End with

r should be your row.

--
Regards,
Tom Ogilvy


"rmcompute" wrote:

I set up a few columns of data with an autofilter. The user selects only 1
row at a time with the auto filter. I want to set up a macro to copy this
row to another area of the worksheet for graphing. When All is selected by
the filter, the first record is row 5. I can set up a macro to copy row 5 to
another location for graphing. However, when a user selects any other row,
row 5 of the spreadsheet is now replaced by that row and the macro does not
work. Is there a way to determine what row the user selects by a filter, and
copy that row to another area of the spreadsheet ?

Reply
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
Macro / Autofilter / Show All Data CousinExcel Excel Discussion (Misc queries) 3 February 17th 10 01:28 PM
macro error - copying data twice Gretta Excel Discussion (Misc queries) 1 April 6th 07 08:14 PM
How can i Change Autofilter data from top till bottom in macro Vijay Kotian Excel Discussion (Misc queries) 0 September 5th 06 09:10 AM
Macro Help - Copying and appending data Louis Markowski Excel Worksheet Functions 1 September 16th 05 06:53 PM
Copying Data into another worksheet using macro Andy W Excel Programming 1 February 19th 04 04:01 PM


All times are GMT +1. The time now is 05:38 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"