简体   繁体   English

从工作表单元格更新 Excel 用户表单

[英]Update Excel Userform From Worksheet Cells

I have the following userform in one macro-enabled excel workbook.我在一个启用宏的 excel 工作簿中有以下用户表单。 It needs me to fill all the empty cells every time and click update to set the cell values to be used for further calculations.它需要我每次填充所有空单元格并单击更新以设置单元格值以用于进一步计算。 I am looking forward to finding an alternative to fill these cells from the worksheet range and by-pass clicking this Update button.我期待找到一种替代方法来填充工作表范围中的这些单元格并绕过单击此更新按钮。

I am new to VBA and struggling to answer this for a month now, any help would be highly appreciated.我是 VBA 的新手,一个月来一直在努力回答这个问题,我们将不胜感激。 Thanks in advance!提前致谢!

用户表单示例

This looks very simple issue.这看起来很简单的问题。 Try below codes.试试下面的代码。 Adjust sheet name and textbox names to UserForm as well as cells addresses.将工作sheet名称和文本框名称调整为UserForm以及单元格地址。

Private Sub cmdUpdate_Click()
    Me.TextBox1 = Sheets("Sheet1").Range("A1")
    Me.txtMyBox = Sheets("Sheet1").Range("B1")
End Sub

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM