我正在使用Excel并希望根据单元格地址(例如A3)获取表格的名称,此单元格不会移动。我将如何在Excel的VBA中说明这一点?
我的计划是将代码从我的维护选项卡上的一个表的行复制数据验证到我工作簿的每个选项卡上的单个表(减去我的“TOC”和“数据”选项卡)。每个选项卡都是“模板”工作表的副本(减去“TOC”,“数据”和“TEMPLATE(Maint。)”工作表)。工作表“data”,“TEMPLATE”和“TEMPLATE(Maint。)”可能会隐藏也可能不会隐藏。
编辑:我想通过以下方式来做这件事:
我的“Copy_Data_Validations”子代码中的代码如下:
import threading
import socket
print("[*] Starting HazimIDS\n")
def Scan(port):
while True:
noPrint = ''
stcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sudp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
stcp.bind(('127.0.0.1', port))
sudp.bind(('127.0.0.1', port))
Threads = StartListening(stcp, sudp)
TCPThread = Threads[0]
UDPThread = Threads[1]
ConnectionThread = threading.Thread(target=DealWithConnections, args=(TCPThread, UDPThread))
RawPackThread = threading.Thread(target=PrintConnections, args=(listConnection))
ConnectionThread.start()
RawPackThread.start()
while True:
try:
TCPTrue
portstr = str(port)
for x in range(len(recentports)):
port = recentports[x]
if portstr == port:
noPrint = 'true'
else:
continue
if noPrint == '':
recentports.append(portstr + "-tcp")
print("[*] New Connection Found on port: " + portstr)
else:
continue
except NameError:
continue
def ListenTCP(socketObj):
while True:
socketObj.listen(1)
global TCPConnection
TCPConnection = 'true'
def ListenUDP(socketObj):
while True:
data, addr = socketObj.recvfrom(4096)
global UDPConnection
UDPConnection = ['true', addr]
def StartListening(socketObjTCP, socketObjUDP):
ttcp = threading.Thread(target=ListenTCP, args = (socketObjTCP))
tudp = threading.Thread(target=ListenUDP, args = (socketObjUDP))
return([ttcp, tudp])
def DealWithConnections(TCPThread, UDPThread):
TCPThread.start()
UDPThread.start()
global listConnection
listConnection = []
while True:
if TCPConnection == 'true':
try:
test = listConnection[1]
except IndexError:
listConnection.append('tcp')
elif UDPConnection[0] == 'true':
try:
test = listConnection[1]
except IndexError:
listConnection.append('udp')
def PrintConnections(globalListConnection):
while True:
try:
test = globalListConnection[1]
fListVar = globalListConnection[0]
if test == 'tcp':
global TCPTrue
elif test == 'udp':
global UDPTrue
elif fListVar == 'tcp':
global TCPTrue
elif fListVar == 'udp':
global UDPTrue
except IndexError:
continue
def main():
for x in range(4000):
ScanThread = threading.Thread(target=Scan, args=(x))
ScanThread.start()
if __name__ == "__main__":
main()
答案 0 :(得分:3)
Sub test()
Dim ws As Worksheet
With Application
.DisplayAlerts = False
.ScreenUpdating = False
End With
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "TOI" And ws.Name <> "DATA" And ws.Name <> "TEMPLATE (Maint.)" Then
Sheets("TEMPLATE (Maint.)").Select
Range("Table1").Select
Selection.Copy
ws.Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValidation, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End If
Next
With Application
.DisplayAlerts = True
.ScreenUpdating = True
End With
End Sub