View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Excel Form annoyance

Sub Test_Dataform()
Range("A1").CurrentRegion.Resize(,4).Name = "'" & _
ActiveSheet.Name & "'!Database"
ActiveSheet.ShowDataForm
End Sub

Would handle the data in E1 or even if there were no data in E1. Also
included your new advice on using sheet level name.
--
Regards,
Tom Ogilvy


"okaizawa" wrote in message
...
Tom Ogilvy wrote:
Why not just

Sub Test_Dataform()
Range("A1:D1").CurrentRegion.Name = "Database"
ActiveSheet.ShowDataForm
End Sub

Assuming There are headings in A1:D1


i wondered if there was something in column E.
but i might have done an unnecessary thing.
if CurrentRegion is enough, this will work, too:

Range("A1").CurrentRegion.Name = "'" & ActiveSheet.Name & "'!Database"

the name 'Database' should be a sheet level name, or we should delete it
after closing the form. if a workbook has multiple sheets and a workbook
level name 'Database', Data Form on other sheets may not be displayed.

--
HTH,

okaizawa