Skip to content

Instantly share code, notes, and snippets.

@dancobb
Created December 16, 2021 23:19
Show Gist options
  • Save dancobb/aa59a815e11fd795b03400ed3d3fc38d to your computer and use it in GitHub Desktop.
Save dancobb/aa59a815e11fd795b03400ed3d3fc38d to your computer and use it in GitHub Desktop.
Excel stuff with sausages
sub copypastesomesausagestuff()
'Need a worksheet
dim anewsheet as worksheet
set anewsheet = workbooks("filename.xlsm").worksheets.add
anewsheet.name = "sheetname" 'Probably want a function here to give it a dynamic name
'Copy and paste the things. Make sure to update ranges.
range("A1:B5").copy workbooks("filename.xlsm").worksheets(anewsheet).range("A1:B5") 'Note the anewsheet reference here is the variable from above.
'This deselects the copied stuff so your clipboard is good.
application.cutcopymode = false
end sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment