Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
runtime error '1004' | Excel Discussion (Misc queries) | |||
excel chart export error runtime 1004 | Charts and Charting in Excel | |||
Excel 2003 Macro Error - Runtime error 1004 | Excel Discussion (Misc queries) | |||
runtime error 1004 when opening excel file via VBA in a browser | Excel Programming | |||
runtime error 1004 | Excel Programming |