View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Mike Fogleman Mike Fogleman is offline
external usenet poster
 
Posts: 1,092
Default ShowDataForm of Worksheet class failed

Excel tries to determine on its own where the data table is by contiguous
cells, when you call for the DataForm. If you have more than one area of
contiguous cells, then Excel is confused as to which table it should use,
and therefore errors. You tell Excel which table to use by naming it
"Database". I have a workbook with 12 little 'Databases' on one hidden
sheet. Each area is separated by blank cells. When I want the DataForm to
show a certain area, I activate the upper left cell of the area and tell
Excel Activecell.CurrentRegion.Name = "Database". Then the DataForm knows to
use that area only.
I hope this explains it a little clearer.

Mike F
"doco" wrote in message
...
That did the trick. I am not sure why that would matter but - it worked
thanks.

doco


"Mike Fogleman" wrote in message
...
Try naming the range "Database" like this:

Sub AddProduct()
Application.ScreenUpdating = False

Range("AA1:AB1").Select
Range(Selection, Selection.End(xlDown)).Select ' error with
or
without this line

Selection.Name = "Database"

Application.CutCopyMode = False ' error
with or without this line
ActiveSheet.ShowDataForm '
produces the error

Application.ScreenUpdating = True

End Sub

Mike F

"Don Cossitt" wrote in message
...
Sub AddProduct()
Application.ScreenUpdating = False

Range("AA1:AB1").Select
Range(Selection, Selection.End(xlDown)).Select ' error with
or without this line
Application.CutCopyMode = False ' error
with or without this line
ActiveSheet.ShowDataForm '
produces the error

Application.ScreenUpdating = True

End Sub

I can produce the form manually selecting Data|Form. However, when
trying to add more items, get "cannot extend list or database".

Any ideas?

TIA
doco