+ Reply to Thread
Results 1 to 4 of 4

Referncing data in column A to determine Row for data entry

  1. #1
    Registered User
    Join Date
    04-13-2010
    Location
    Ames, Iowa
    MS-Off Ver
    Excel 2007
    Posts
    1

    Referncing data in column A to determine Row for data entry

    I am trying to create a User Form that will enter data into a spreadsheet. I want the user of the form to be able to enter a date as the first piece of information in the User Form, this date will then correspond with the row in which the remaining data is entered (note all relevant dates are already in the spreadsheet so I am just doing a find function to locate the date in the row corresponding to where I want the data to go)

    I am very new to VBA so I am not sure that I am even approaching this the right way but here is what I have so far:

    Please Login or Register  to view this content.

    I'm not sure why this isn't working, I am getting an error message:

    Run-time error '1004':
    Application-defined or object-defined error

    Not sure what it means but I did notice when I run the cursor over iRow in the ws.cells(iRow, 5) it is displaying a value of -1 which seems wrong to me.

    Any help would be greatly appreciated, thanks!
    Last edited by dtt084; 04-13-2010 at 02:13 PM.

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Referncing data in column A to determine Row for data entry

    Your post does not comply with the Forum Rules regarding use of code tags. All VBA code must be wrapped in code tags. After editing your post to apply the code tags solutions will be suggested.

    Rule #3
    Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # button at the top of the post window. If you are editing an existing post, press Go Advanced to see the # button. For more information about these and other tags, click here.
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  3. #3
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Referncing data in column A to determine Row for data entry

    The error occurs because you are attempting to "activate" a variable, dimensioned as long, treating it as a range object.

    See this link for help on the Find Method

    You can keep iRow as a Long variable and dimension a new variable as a range.

    Please Login or Register  to view this content.

    If Find returns a result you can reference the row property of the range object and continue using iRow as you have further in the code.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Referncing data in column A to determine Row for data entry

    Change "Activate" to "Row"
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1