Skip to content

Instantly share code, notes, and snippets.

@danwagnerco
Created March 29, 2017 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danwagnerco/770ef3ec7d0b94c9e43a3ed2cef95e99 to your computer and use it in GitHub Desktop.
Save danwagnerco/770ef3ec7d0b94c9e43a3ed2cef95e99 to your computer and use it in GitHub Desktop.
small adjustment
'don't do this anymore:
DataBlock.SpecialCells(xlCellTypeVisible).Copy Destination:=Target.Cells(1, 1)
'instead try this:
Dim rngDestination As Range 'this should be way up at the top with all the other declarations
' ... all the other code
Set rngDestination = Target.Cells(1, 1)
DataBlock.SpecialCells(xlCellTypeVisible).Copy
rngDestination.PasteSpecial xlPasteType:=xlPasteValuesAndNumberFormats
@dmikester1
Copy link

Thanks! Getting "Compile Error: Named argument not found" on this code: "XlPasteType:="

@dmikester1
Copy link

dmikester1 commented Mar 30, 2017

After some googling, I figured this out: rngDestination.PasteSpecial Paste:=xlPasteValuesAndNumberFormats
Thanks again for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment