LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excel 2002 Data Forms runtime error 1004

Run code like this

Sub MakeName()
With worksheets("Sheet1")
.Range("B8:Z30").Name = "Database"
End with
End Sub

change the sheet name and the range to reflect where your database is
located.

--
Regards,
Tom Ogilvy

"Charles Osborne" wrote in message
...
Oops. My mistake. The range that is showing up in the
"Refers to:" box is not the range of the data for the
Database I want. It is a random cell wherever the cursor
focus is. Sorry.

~~Charles
-----Original Message-----
http://support.microsoft.com/default...;en-us;q110462
XL: ShowDataForm Method Fails If Data Can't Be Found
Describes the problem.

Excel looks in a range named DataBase, then the range

A1:B2. If it can't find
it, you get the error.

So the easiest workaround is to name your range DataBase.

Maybe even in the VBA code:

.....
Range("e19").currentregion.name = "database"
activesheet.showdataform
....

depending on where your database is located.


Charles Osborne wrote:

I made a macro attached to a button on a worksheet to click
DataForms and go to a text formatted cell that has a label
on the same page. The cells to the right of this cell also
have labels so that the data form will show a list. When I
click the button to start the macro I get a runtime error
1004 message if Range().Select is anything other than a1 or
a2. Error reads "ShowDataForm method of Worksheet class
failed". If I put the label in cells a1 or a2 it works fine
but gives me a message before allowing me to continue. When
I click OK it lets me continue and works fine. The message
here reads:

"MS Excel cannot determine which row in your list or
selection contains column labels, which are required for
this command.

*If you want the first row of the selection or list used as
labels and not as data, click OK.
*If you selected a subset of cells in error, select a
single cell, and try the command again.
*To create column labels, click Cancel, and enter a text
label at the top of each column of data.
*For information about creating labels that are easy to
detect, click Help."

The situation at the first * above matches my situation, so
I click OK.

The macro code that works here is below:
Sub CountDinners()
'
' CountDinners Macro
' Macro recorded 5/1/2004 by charles osborne
'
'
Range("a2").Select
ActiveSheet.ShowDataForm
End Sub

Any help is appreciated. If you like I can send file.

Thanks!
~~Charles Osborne


--

Dave Peterson

.



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
runtime error '1004' Steve Excel Discussion (Misc queries) 1 April 28th 06 08:58 PM
excel chart export error runtime 1004 Mau Charts and Charting in Excel 3 August 17th 05 11:35 AM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
runtime error 1004 when opening excel file via VBA in a browser Ken Hunter Excel Programming 2 July 31st 03 03:33 PM
runtime error 1004 Adella Excel Programming 2 July 29th 03 08:07 PM


All times are GMT +1. The time now is 10:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"