对此我很陌生,因此很抱歉,如果它简单但希望有人可以提供帮助。 我有一个输入框,可以将新人添加到表格中。然后,这将复制模板,并重命名为人员名称。我需要参考单元格I3和已创建的新工作表上的其他单元格,然后将其输入表中其名称旁边。下面是到目前为止我得到的代码
'input box to get new user name and check if valid and create new sheet
Dim wb As Workbook: Set wb = ThisWorkbook
Dim ws As Worksheet: Set ws = wb.Sheets("Player Template")
Dim newws As Worksheet, sh As Worksheet, newname
Dim query As Long, xst As Boolean, info As String
retry:
xst = False
newname = Application.InputBox("Please Enter New players Name.", info, , , , , , 2)
If newname = "False" Then Exit Sub
For Each sh In wb.Sheets
If sh.Name = newname Then
xst = True: Exit For
End If
Next
If Len(newname) = 0 Or xst = True Then
info = "Name is invalid. Please Retry."
GoTo retry
End If
ws.Copy after:=ws: Set newws = ActiveSheet: newws.Name = newname
Sheets("Table").Select
Range("C6").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = newname
ActiveCell.Offset(0, 1).Select
ActiveCell.Value =
我不知道要添加什么代码来引用表格中我需要的单元格,除了在添加人员之后手动执行之外。我一直在寻找答案,但一无所获。
答案 0 :(得分:0)
此代码将复制一个名为“玩家模板”的工作表,并在输入框的名称下创建该工作表。范围I3:M3中的引用将复制到工作表“表”列“ C”中的下一个空闲行。 C&lastrow get的玩家的工作表名称以及该名称右侧的列均填充有对该工作表的引用
$arr1 = ["pack_id","pack_name","cash"];
$arr2 =["pack_id","pack_name","inactifs","actifs","total"];
$res = array_unique(array_merge($arr1, $arr2));
var_dump($res);