Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
bob bob is offline
external usenet poster
 
Posts: 52
Default copy from a list

I wrote the following macro to copy the contents of the
cell above the cursor into the cursor's current location.

ActiveCell.Offset(-1, 0).Range("A1").Select
Selection.copy
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveSheet.Paste

It works fine until I filter the list. For example, when
I fliter, the cursor might be on A12 and the next row up
is A10. When I run my macro, it returns the value that's
in A11. (A11 isn't displayed since it was filtered out).

What should the macro be?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default copy from a list

Sub AAAcopydown()
Dim cell As Range
Set cell = ActiveCell.Offset(-1, 0)
Do While cell.EntireRow.Hidden = True And cell.Row 1
Set cell = cell.Offset(-1, 0)
Loop
If cell.EntireRow.Hidden = False Then
ActiveCell.Value = cell.Value
End If
End Sub

would be a start.

--
Regards,
Tom Ogilvy




"Bob" wrote in message
...
I wrote the following macro to copy the contents of the
cell above the cursor into the cursor's current location.

ActiveCell.Offset(-1, 0).Range("A1").Select
Selection.copy
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveSheet.Paste

It works fine until I filter the list. For example, when
I fliter, the cursor might be on A12 and the next row up
is A10. When I run my macro, it returns the value that's
in A11. (A11 isn't displayed since it was filtered out).

What should the macro be?



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
Copy list only with values? hoyos Excel Discussion (Misc queries) 6 October 7th 09 10:06 PM
Copy to list Garrystone Setting up and Configuration of Excel 0 June 1st 08 04:05 PM
copy csv list Stefani Excel Discussion (Misc queries) 3 January 13th 08 12:51 AM
Copy # fm one list to matching id in list 2? Curalice Excel Worksheet Functions 3 February 10th 06 09:33 PM
How to remove duplicates from a list and copy new list to new colu Chance Excel Worksheet Functions 2 April 23rd 05 05:21 AM


All times are GMT +1. The time now is 08:01 AM.

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

About Us

"It's about Microsoft Excel"