humboldtcountyguy
New Member
- Joined
- May 21, 2010
- Messages
- 20
Can anyone tell me why the code below copies an entire table of blank rows instead of only those with data? And more importantly, how do i fix it? Thanks in advance guys ![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Code:
Sub ConsolidateCSV()
Dim sh As Worksheet, lr As Long, rng As Range
Dim si As Worksheet
Set sh = WorkSheets("Tables")
Set si = Worksheets("CSV")
lr = sh.Cells(Rows.Count, "A").End(xlUp).Row 'This finds the last row in the range
sh.Range("A2:E" & lr).Copy
Set pst = si.Range("a5535").End(xlUp).Offset(1, 0)
pst.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End Sub