Excel创建一个按钮,将值放在特定单元格中

时间:2013-03-28 00:12:18

标签: excel excel-vba button vba

我正在尝试创建一个excel电子表格,每当我按下一个按钮时,它会从一张纸上读取信息,并且(根据该信息)填写具有特定值的另一张纸上的单元格。

例如:

学生输入他们的测试答案。 excel文档根据数据库检查所有答案并计算分数并将其与某些目标相关联(我已经得到了这些目标)。

然后,学生按下“更新”按钮。该程序将读取学生的姓名(提供行#)和他们采取的测试(提供列 - 我仍然不确定如何用字母提出特定的列,所以这也会有帮助)并用学生的分数更新该单元格。

我该怎么做?

1 个答案:

答案 0 :(得分:0)

好的,像你说的那样的代码,我曾经做过。我可以为你解答。但是因为我根本没有看到你的努力。所以我只是给你我的代码并解释它,然后你需要将它改为你的问题代码。 OK?

      c = TB1.Value >> (My textbox for user to fill in their name that same with the sheet row value)

    Cells.Find(What:=c, After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
            xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
            , SearchFormat:=False).Activate
        myRow = ActiveCell.Row
        rtb = myRow >> My Row XX Value just like you said want to know at what row hold that value.

    e = coltb.Text >> (My textbox for user to fill in their date value that will be find in column)
    Cells.Find(What:=e, After:=ActiveCell, LookIn:=xlFormulas, _
        LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
        MatchCase:=True, SearchFormat:=True).Activate
        myColumn = ActiveCell.Column
        ctb = myColumn >>> (My Column XX value just like for know what is the column that hold the value)

Worksheets("Sheet1").Cells(rtb, ctb) = Val(Score) > Your RTB(Row value) + CTB(Column Value) then the score of your test.
可能是这样的,不是你想要的吗? 此代码在VBA中使用,导致您的标签使用VBA

希望会有所帮助