开发者

VBA Excel dataform not displaying the right input and fields

开发者 https://www.devze.com 2023-03-08 13:16 出处:网络
I have the following VBA code, which should show a dataform from another hidden sheet. Sub CoverageBssEntry()

I have the following VBA code, which should show a dataform from another hidden sheet.

Sub CoverageBssEntry()

   Applicatio开发者_如何学Pythonn.ScreenUpdating = False
   Sheets("myhiddensheet").Select
   Range("myTable[#All]").Select
   ActiveSheet.ShowDataForm

End Sub

When I run this, the data form does not containt the labels and inputboxes of this table.

Any help is really appreciated, because it is driving me nuts! My only other option is to spend time to build custom made user forms, while this would do perfectly.


You cannot select a hidden sheet. And anyway the .Select statements are not necessary

Try

Sheets("myhiddensheet").ShowDataForm


The fix is to use:

ActiveSheet.Cells(x,y).Select 

prior calling the .ShowDataForm, works like a jiffy!


I think there are genuine constraints with the ShowDataForm command. It works fine if invoked outside of VBA while in a specific range. But once coded into VBA, it will only return the form for the first table in the referenced worksheet, even if a macro was recorded to perform that action. I cannot tell why. Maybe because the showdataform event is tied to the worksheet and not to the table or list selected when it is called. Sorry guys. Maybe microsoft will improve this in the future.

0

精彩评论

暂无评论...
验证码 换一张
取 消