VBA issue with appending data

MikeL

Active Member
Joined
Mar 17, 2002
Messages
492
Office Version
  1. 365
Platform
  1. Windows
Hello,
I have been working on filtering data from 2 Workbooks and pasting to 1 Consolidated Workbook. My issue is with executing the code to append the data in Consolidated with the data from the second workbook

Code:
'Copy Data from Second Workbook (filtered, don't include header row A1)
Dim LR As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
Range("A2:K" & LR).SpecialCells(xlCellTypeVisible).Select
Selection.Copy

'Activate Consolidation WB and append (find next blank row and paste data)
Consolidation.Activate
With Sheets("Sheet1")
.Range("A1" & .Range("A" & .Rows.Count).End(xlUp).Row + 1).PasteSpecial Paste:=xlPasteAll
End With
Application.CutCopyMode = False


The problem is the character "-" appears in multiple lines between the two data sets.
Why does the dash appear? Thinking it might be something from copying the filtered data


thanks, Mike
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
I was able to solve by replacing

.Range("A1" & .Range("A" & .Rows.Count).End(xlUp).Row + 1).PasteSpecial Paste:=xlPasteAll

with the below
.Range("A1").End(xlDown).Offset(1).PasteSpecial Paste:=xlPasteAll


Thanks
 
Upvote 0
Sounds odd. Does this do the same thing?

Code:
'Copy Data from Second Workbook (filtered, don't include header row A1)
Dim LR As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
Range("A2:K" & LR).SpecialCells(xlCellTypeVisible).Copy Destination:=Consolidation.Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Offset(1)
Application.CutCopyMode = False
 
Upvote 0
Your code worked VoG.. I tried with multiple files and no "-" were created between the two data sets.

Thanks, Mike
 
Upvote 0

Forum statistics

Threads
1,224,514
Messages
6,179,223
Members
452,896
Latest member
IGT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top