使用下拉列表重命名工作表

时间:2016-11-30 11:16:33

标签: excel-vba vba excel

我使用以下代码重命名工作表。

Option Explicit

Sub RenWSs()

    Dim ws As Worksheet
    Dim shtName
    Dim newName As String
    Dim i As Integer
    Dim RngStr  As String

    RngStr = Application.InputBox(prompt:="Select the Range for the new Sheet's name", Type:=2)
    For Each ws In Worksheets
        With ws
            If Trim(.Range(RngStr)) <> "" Then
                shtName = Split(Trim(.Range(RngStr)), " ")
                newName = shtName(0)
                On Error GoTo ws_name_error
                .Name = .Range(RngStr)
                GoTo done
repeat:
                .Name = newName & i
                GoTo done
ws_name_error:
                i = i + 1
                Resume repeat
            End If
        End With
        On Error GoTo 0
done:
    Next

End Sub

在此我通过输入框选择新名称并且工作正常。现在我想要的是,在调用输入框之前,必须完成以下过程。

我在下拉列表中有名字,下拉列表中的每个名字都要在所有工作表中逐个更新,例如J16就是单元格。

请帮帮我

1 个答案:

答案 0 :(得分:0)

以下代码将覆盖所有tf.SparseTensor张,并修改&#34; J16&#34;中的单元格的值。到&#34;测试1&#34; (仅用于测试目的)。

inputs_sparse = tf.SparseTensor(
    # The coordinates of the non-zero entries.
    indices=tf.constant([[0, 0], [0, 1], [0, 2], [0, 3],
                         [1, 0], [1, 1]]),
    # The values of the respective non-zero entries.
    values=tf.constant([0, 1, 2, 3,
                        3, 2]),
    # The shape of the corresponding dense tensor (must be >= [2, 4]).
    shape=[2, 4],
)
相关问题