+ Reply to Thread
Results 1 to 14 of 14

Run Time error 438 - using Rows.Count

  1. #1
    Forum Contributor
    Join Date
    04-22-2014
    Location
    Turrialba, Costa Rica
    MS-Off Ver
    Excel 2010
    Posts
    108

    Unhappy Run Time error 438 - using Rows.Count

    Hello.
    I am exporting a query to MS Excel and this time,I am trying to edit an xlBarStacked Chart from MS Access without using Excel as a reference.

    This part of my code works fine:

    Please Login or Register  to view this content.
    Looking for to set min and max date for axis values into x axis, I add the following code:

    Please Login or Register  to view this content.
    When I run Debug->Compile from the VB Editor's main menu, there is no alert about any recognized names.
    However, when I execute the code from Access Button, I get an error here:

    Please Login or Register  to view this content.


    I've tried numerous different ways of fixing this problem, such as rewriting the line, changing sheet names. I have been googling and I can't seem to find any documentation on this scenario.

    I'd really appreciate any help.

  2. #2
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: Run Time error 438 - using Rows.Count

    Without the workbook it's a longshot, but should rows.count not be preceeded by a dot?
    Cheers!
    Tsjallie




    --------
    If your problem is solved, pls mark the thread SOLVED (see Thread Tools in the menu above). Thank you!

    If you think design is an expensive waste of time, try doing without ...

  3. #3
    Forum Contributor
    Join Date
    04-22-2014
    Location
    Turrialba, Costa Rica
    MS-Off Ver
    Excel 2010
    Posts
    108

    Re: Run Time error 438 - using Rows.Count

    Hello.
    Thanks for your reply.
    With the dot I tried two lines of code

    With this code:
    Please Login or Register  to view this content.
    This message is displayed:
    Please Login or Register  to view this content.
    With this code:

    This message is displayed:
    Please Login or Register  to view this content.
    Could you advise me, how to fix such errors?

    Please. Can you tell me what you mean with:
    "Without the workbook, it's a longshot"..

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,572

    Re: Run Time error 438 - using Rows.Count

    [COLOR="#FF0000"]
    Please Login or Register  to view this content.
    Or:
    Please Login or Register  to view this content.
    *Is Application.wsFunction the same as Application.WorksheetFunction in Excel 2010?
    Last edited by alansidman; 10-13-2018 at 09:20 PM.
    Ben Van Johnson

  5. #5
    Forum Contributor
    Join Date
    04-22-2014
    Location
    Turrialba, Costa Rica
    MS-Off Ver
    Excel 2010
    Posts
    108

    Re: Run Time error 438 - using Rows.Count

    Thank you for your reply.

    I don't know, I am using MS Access 2016 and MS Excel 2016.

    When I executed the code by the first time I used:
    Please Login or Register  to view this content.
    Then, I used:
    Please Login or Register  to view this content.
    Every time VBA displays error messages.

    I have to tell you that to write this code I recorded a macro in Excel.
    Then, I refined the code trying to adapt it to VBA for MS Access.

    All code works fine, except the lines under analysis.

    I appreciate your help

    Cheers

  6. #6
    Forum Contributor
    Join Date
    04-22-2014
    Location
    Turrialba, Costa Rica
    MS-Off Ver
    Excel 2010
    Posts
    108

    Re: Run Time error 438 - using Rows.Count

    Hello.
    When I type the code to see the IntelliSense,
    Please Login or Register  to view this content.
    The above code line is coloured red and "A" is coloured in blue.
    I have no idea how to fix the error.

    Thanks

  7. #7
    Forum Contributor
    Join Date
    04-22-2014
    Location
    Turrialba, Costa Rica
    MS-Off Ver
    Excel 2010
    Posts
    108

    Re: Run Time error 438 - using Rows.Count

    Hello

    This code works

    Please Login or Register  to view this content.
    See the (,) instead of (.)

    But codes:
    Please Login or Register  to view this content.
    or
    Please Login or Register  to view this content.
    Displays:
    Error 438 "object doesn't support this property or method.

    I have no idea on how to fix the error 438.

    Cheers

  8. #8
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: Run Time error 438 - using Rows.Count

    With "without the workbook it's a longshot" I mean that it's hard to see what's going wrong when I can't see the context.
    It helps if you make the workbook available, so I can debug it.

    Attach a sample workbook (not a picture or pasted copy).

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  9. #9
    Forum Contributor
    Join Date
    04-22-2014
    Location
    Turrialba, Costa Rica
    MS-Off Ver
    Excel 2010
    Posts
    108

    Re: Run Time error 438 - using Rows.Count

    Thanks.
    I attach the workbook with the Chart I need to create form MS Access.
    Also, the code is included.
    Cheers
    Attached Files Attached Files

  10. #10
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: Run Time error 438 - using Rows.Count

    From post #4:
    Please Login or Register  to view this content.
    is missing the variable to store the result in.
    If you're looking for the rownumber, try
    Please Login or Register  to view this content.
    Same applies to b.

    From post #7:
    Please Login or Register  to view this content.
    I think wb. should be ws. So:
    Please Login or Register  to view this content.
    Without apostrophe!

  11. #11
    Forum Contributor
    Join Date
    04-22-2014
    Location
    Turrialba, Costa Rica
    MS-Off Ver
    Excel 2010
    Posts
    108

    Re: Run Time error 438 - using Rows.Count

    Hello.

    I adjusted the code and got now an error againg:
    Please Login or Register  to view this content.
    VBA displays here:
    Please Login or Register  to view this content.
    I understand Error number 1004 means: "Look, I can't find what you are looking for".

    I am looking for:
    Please Login or Register  to view this content.
    Since this morning I have tried googling in all types of VBA Forums for the solution, but I have not found it and I can't figure it out.
    That's why I posted again.

    Any help would be very much appreciated.
    Cheers

  12. #12
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,572

    Re: Run Time error 438 - using Rows.Count

    1. You have: Dim a, b As Range; note that 'a' is not declared as a Range variable but as a Variant. Each variable must be typed explicitly.

    2. Given: Set ws = Worksheets("qry_xlBarStacked") --> that's not the sheet name. I should be: Set ws = Worksheets("qry_creategantt"). Why not use a more descriptive self documenting name, say, GanttData vs. ws: Set GanttData = Worksheets("qry_creategantt")


    3. you have
    Please Login or Register  to view this content.
    It should be:
    Please Login or Register  to view this content.
    Last edited by alansidman; 10-15-2018 at 06:25 PM.

  13. #13
    Forum Contributor
    Join Date
    04-22-2014
    Location
    Turrialba, Costa Rica
    MS-Off Ver
    Excel 2010
    Posts
    108

    Re: Run Time error 438 - using Rows.Count

    protonLeah. Hello

    With items 1 and 2 I am in complete agreement.
    With point 2, I was testing many code lines and I tried to save queries with different name trying to keep code traceability.

    The code you send to me is the last and most important link in my project.

    Thank you very much indeed.

    Cheers

  14. #14
    Forum Contributor
    Join Date
    04-22-2014
    Location
    Turrialba, Costa Rica
    MS-Off Ver
    Excel 2010
    Posts
    108

    Re: Run Time error 438 - using Rows.Count

    Thanks to protonLeah and Tsjallie for your help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to Count number of overlapping rows within a time interval
    By czou6 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-10-2013, 04:45 PM
  2. autofilter, visible rows count error
    By florin_excel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-24-2013, 11:22 AM
  3. [SOLVED] Macro to count rows and copy data error help
    By Drunsul in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-13-2012, 01:39 PM
  4. Finding count of rows within time range
    By ChrisMu1 in forum Excel General
    Replies: 8
    Last Post: 05-01-2012, 11:37 AM
  5. Error in count down time and count up time
    By marc5354 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-31-2010, 06:55 PM
  6. Rows.Count error in dynamic range naming
    By Andrew-Mark in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 04-07-2010, 03:27 AM
  7. [SOLVED] Count error frequency in huge column:full time
    By PJohnson in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-28-2005, 04:05 PM

Tags for this Thread

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