Thread: Paste Problem
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rich[_16_] Rich[_16_] is offline
external usenet poster
 
Posts: 22
Default Paste Problem

I have had a persistant problem that will just not go away. And I have
the boss breathing down my neck. So any help will be greatly
appreciated. I have had a macro that was working for months then
stopped working. Below is some of the code.

The goal of the macro is to open up spreadsheets and then append the
data to the next available blank cell so that the users data is all in
one spreadsheet.

Some of Code :

While Len(lcTheSource) 0
lcFileName = lcPath & "\" & lcTheSource

Workbooks.Open FileName:=lcFileName
Set wb = ActiveWorkbook

Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=41, Criteria1:="FB"
Range("A1").Select
Set rngSource =
ActiveSheet.Cells.SpecialCells(xlCellTypeVisible)
wbNew.Activate
Range("A1").Select
If Len(Trim(ActiveCell.Value)) 0 Then
lnLastRow = ActiveSheet.UsedRange.Rows.Count + 1
Else
lnLastRow = 1
End If
lcCell = "A" & Trim(CStr(lnLastRow)) & ""
Range(lcCell).Select
Set rngDestination = ActiveSheet.Range(lcCell)
rngSource.Copy rngDestination < --- Crashes here.

The above code works on the first run but then I get an error that
says :

Run-Time error '1004'

The information cannot be pasted because the Copy area and the paste
area are not the same size and shape. Try one of the following:

1.) Click a single cell, and then past
2.) Select a rectangle that's the same size and shape, and then paste.

I did 1 and 2. Nothing worked. How else can I do the task above.