PC Review


Reply
Thread Tools Rate Thread

Copy and paste only filtered cells

 
 
Eric_G
Guest
Posts: n/a
 
      12th Jul 2009
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.
 
Reply With Quote
 
 
 
 
Doug Glancy
Guest
Posts: n/a
 
      12th Jul 2009
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" <(E-Mail Removed)> wrote in message
news:220B3F97-3742-49D0-AAE1-(E-Mail Removed)...
> 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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy visible cells after filtered paste to first empty cell Xrull Microsoft Excel Programming 1 26th Jun 2008 03:39 PM
copy and paste filtered cells Rich Microsoft Excel Misc 1 27th Feb 2008 01:50 AM
Copy and Paste Filtered Cells in Excel 2007 Gillian Microsoft Excel Misc 0 5th Dec 2007 03:46 PM
Re: copy and paste filtered data Gord Dibben Microsoft Excel Misc 0 17th Jan 2007 11:07 PM
Copy Paste of Filtered Data "Uses" too many Cells =?Utf-8?B?RGVubmlz?= Microsoft Excel Misc 1 25th Oct 2004 10:02 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:14 AM.