在表中添加新行时,Excel会停止工作 [英] Excel stops working when adding new row to the Table

查看:397
本文介绍了在表中添加新行时,Excel会停止工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道为什么,但是当我尝试做这个Excel退出而不保存任何东西:

I don't know why but when I try to do this Excel Quits without saving anything:


  1. Sheet1 我有11行x 6 cols格式化为表。第一行为表头。

  1. On Sheet1 I have 11 Rows x 6 cols formatted as Table. With 1st row as Table Header.

我将 col A 分配为 STU_ID 使用名称管理器命名范围。

I assign col A as a STU_ID Named Range using Name Manager.

我只有一个列表框在Userform上。并且我将RowSource属性赋予为 = STU_ID 。我得到列表框中的 col A 数据。

I have only a listbox on the Userform. And I give RowSource property as =STU_ID . I get the col A data on the list box.

现在,当我去 Sheet1 ,并尝试在表的下一行添加更多数据。 Excel退出说它已经停止工作。 Windows正在检查错误,并重新启动一个空白的工作簿

Now when I go to Sheet1 and try to add more data on next row of the table. Excel quits saying it has stopped working. Windows is checking for error and it restarts on a blank Workbook.




不要列表框是动态的,并从名称管理器中获取数据,因为我将其添加到工作表中?

Shouldn't Listbox be dynamic and get data from Name Manager as I add them on the sheet ?



I am using MS Excel Pro 13 on Win 10 64 bit.

推荐答案

这是Excel中的一个错误。作为解决方法,请使用 .List 属性而不是 .RowSource

This is a bug in Excel. As a workaround, use the .List property instead of the .RowSource.

在UserForm的代码中尝试这样的东西:

Try something like this in the UserForm's code:

Private Sub UserForm_Initialize()
  ListBox1.List = Range("table1[abc]").Value
End Sub

它将是动态的,它将工作。

This way it will be dynamic, and it will work.

如果您在显示用户窗体时需要更改,请将小代码放在 Sheet更改事件,每次更改列表时更新列表。 (仅当您的表单属于模式,并且您希望实时反映所做的更改时,才需要此操作。)

If you need it to change while the userform is displayed, put a small code to the Sheet change event, that updates the list every time the sheet changes. (This is only necessary if your form is modal, and you want it to reflect the changes made in real-time.)

这篇关于在表中添加新行时,Excel会停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆