VBA Excel使用表名检查特定表是否存在 [英] VBA Excel check if a particular table exist using table name

查看:260
本文介绍了VBA Excel使用表名检查特定表是否存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Excel工作表中有几个表.每个都有唯一的表名.我想知道当前工作表中是否存在名称为"Table123"的表.

I have several tables in an excel sheet. Each having unique table Name. I want to know if a table which has a name "Table123" exist or not in the current sheet.

有人可以帮我吗?

谢谢 吉文

推荐答案

TableExists = False
On Error GoTo Skip
If ActiveSheet.ListObjects("Table123").Name = "Table123" Then TableExists = True
Skip:
    On Error GoTo 0

此代码将有效并避免循环和错误

This code will work and avoid loops and errors

这篇关于VBA Excel使用表名检查特定表是否存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆