Skip to content

Instantly share code, notes, and snippets.

@zbyna
Created January 9, 2019 00:09
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 zbyna/8bfeb253205a386af6f91e2ad8b50d83 to your computer and use it in GitHub Desktop.
Save zbyna/8bfeb253205a386af6f91e2ad8b50d83 to your computer and use it in GitHub Desktop.
Sub Sheet2_Button1_Click()
'
' Sheet2_Button1_Click Macro
'
Dim Tabulka As ListObject
Dim List As Worksheet
Set List = ActiveSheet ' to get code completion, it does not work on ActiveSheet property
Set Tabulka = List.ListObjects.Add(SourceType:=xlSrcRange, _
Source:=Range("c3:h14"), _
XlListObjectHasHeaders:=xlYes)
Tabulka.DisplayName = "Tabulka"
Set Tabulka = Nothing
Set List = Nothing
End Sub
Sub Button2_Click()
'
' Button2_Click Macro
'
Dim Tabulka As ListObject
Dim List As Worksheet
Set List = ActiveSheet ' to get code completion, it does not work on ActiveSheet property
Set Tabulka = List.ListObjects("Tabulka")
Tabulka.Unlist
Set Tabulka = Nothing
Set List = Nothing
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment