PDA

View Full Version : Paste onto filtered cells



arrun
10-04-2012, 08:53 AM
Can somebody help me to paste onto filtered cells?

I am attaching an excel file. In the 1st sheet I have filtered data. And in the second sheet I have some unfiltered data. I need to have some VBA code so that, I can paste 2nd sheets's data onto 1st sheet, without removing the filter.

I have searched over net for a while however could not find anything.
Thanks,

p45cal
10-07-2012, 04:27 PM
try:Sub blah()
Set SourceRng = Sheets("Sheet2").UsedRange 'you should use something more selective here to define SourceRng
Set Destrng = Sheets("Sheet1").AutoFilter.Range
Set Destrng = Destrng.Offset(Destrng.Rows.Count).Cells(1)
SourceRng.Copy Destrng
Sheets("Sheet1").AutoFilter.ApplyFilter
End Sub