Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Copy and paste only filtered cells

I am attempting to do the following to a filtered spreadsheet via a macro:

a) Filter a spreadsheet based on values in column A -- no problem
b) Paste a text value (i.e. the word "Cash") into the cells (subject to the
filter) which appear in column B all the way down to the last row as
determined by the filter on Column A.

In other words, paste this text value in every row of column B -- but the
rows are based on the filtered values of column A.

Any assistance? Many thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 915
Default Copy and paste only filtered cells

Eric_G wrote:
I am attempting to do the following to a filtered spreadsheet via a macro:

a) Filter a spreadsheet based on values in column A -- no problem
b) Paste a text value (i.e. the word "Cash") into the cells (subject to the
filter) which appear in column B all the way down to the last row as
determined by the filter on Column A.

In other words, paste this text value in every row of column B -- but the
rows are based on the filtered values of column A.

Any assistance? Many thanks.


Copy something to the clipboard (i.e, "Cash")

Select the last visible, pertinent cell in column B

Ctrl+Shift+Arrow Up (now many cells are selected)

Shift+Arrow Down enough times so your column header is not selected

Paste
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Copy and paste only filtered cells

Eric,

This does it with VBA:

Sub Test()
Dim lngLastRow As Long

With ActiveSheet
With .Range("A2")
.AutoFilter
.AutoFilter Field:=1, Criteria1:="a"
End With
lngLastRow = .Range("A" & .Rows.Count).End(xlUp).Row
.Range("B2:B" & lngLastRow).Value = "cash"
End With
End Sub

If you actually want it to paste something that's previously copied, that
would take a little more code.

hth,

Doug

"Eric_G" wrote in message
...
I am attempting to do the following to a filtered spreadsheet via a macro:

a) Filter a spreadsheet based on values in column A -- no problem
b) Paste a text value (i.e. the word "Cash") into the cells (subject to
the
filter) which appear in column B all the way down to the last row as
determined by the filter on Column A.

In other words, paste this text value in every row of column B -- but the
rows are based on the filtered values of column A.

Any assistance? Many thanks.

__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4237 (20090712) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




__________ Information from ESET NOD32 Antivirus, version of virus signature database 4237 (20090712) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



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
Filtered copy and paste error Bagia Excel Discussion (Misc queries) 1 October 21st 09 04:34 PM
Copy and paste - filtered data JLR-Mart Excel Discussion (Misc queries) 2 March 10th 08 09:46 AM
copy and paste filtered cells Rich Excel Discussion (Misc queries) 1 February 27th 08 01:50 AM
Copy and Paste Filtered Cells in Excel 2007 Gillian Excel Discussion (Misc queries) 0 December 5th 07 03:46 PM
copy and paste filtered data Churley Excel Discussion (Misc queries) 6 September 4th 07 04:17 PM


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