+ Reply to Thread
Results 1 to 11 of 11

currency value assigned to variable Error 2023

  1. #1
    Registered User
    Join Date
    06-20-2024
    Location
    Columbia, MD
    MS-Off Ver
    Microsoft365
    Posts
    12

    currency value assigned to variable Error 2023

    I have the following line in my VBA code.


    billrte = Application.VLookup(startNum, Worksheets("" & sheetnm & "").Range("A2:M9999"), 16, False)

    billrte is declared as a variant
    startnum is set at 5
    sheetnm is set to the tab name of IAAI

    This exact line of code appears 8 times previous as I am assigning data to variables and it works every time, until it gets to billrte where it assigns the value of "Error 2023"

    The issue appears to be that the value in the worksheet is a currency.

    If I change the variable to be a currency type it throws a "Type Mismatch" error.

    I have searched the forum and found nothing close to this issue.

    Any help is truly appreciated.

    Tim
    Last edited by thabart1; 06-27-2024 at 12:09 PM.

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,711

    Re: currency value assigned to variable Error 2023

    Fast answers need clear examples.

    Post a small Excel sheet (not a picture) showing realistic & representative sample data WITHOUT confidential information (10-20 rows, not thousands...) and some manually calculated results. For a new thread (1st post), scroll to Manage Attachments, otherwise scroll down to GO ADVANCED, click, and then scroll down to MANAGE ATTACHMENTS and click again. Now follow the instructions at the top of that screen.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,711

    Re: currency value assigned to variable Error 2023

    Try

    billrte = Application.VLookup(startnum, Worksheets(sheetnm).Range("A2:M9999"), 13, False)

    Please Login or Register  to view this content.
    assuming required value in column M
    Last edited by JohnTopley; 06-27-2024 at 10:35 AM.

  4. #4
    Registered User
    Join Date
    06-20-2024
    Location
    Columbia, MD
    MS-Off Ver
    Microsoft365
    Posts
    12

    Re: currency value assigned to variable Error 2023

    If I could upload a file I would. But I keep getting an upload error. I have zipped the file and it is well within the limits.

  5. #5
    Registered User
    Join Date
    06-20-2024
    Location
    Columbia, MD
    MS-Off Ver
    Microsoft365
    Posts
    12

    Re: currency value assigned to variable Error 2023

    JohnTopley - Same error.

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,711

    Re: currency value assigned to variable Error 2023

    I tested the code (as far as I am able) and it worked .....
    Please Login or Register  to view this content.
    No "#REF" or "#N/A" errors ?

    Data in column M is Currency.

  7. #7
    Registered User
    Join Date
    06-20-2024
    Location
    Columbia, MD
    MS-Off Ver
    Microsoft365
    Posts
    12

    Re: currency value assigned to variable Error 2023

    John,

    I truly appreciate your time on this.

    Column M is Currency. No "#REF" or "#N/A" errors.

    I added the msgbox statment and received a Type Mismatch error. When I hover my cursor over billrte it pops up with Error 2023.

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,711

    Re: currency value assigned to variable Error 2023

    We need the file as this must a data problem.

  9. #9
    Registered User
    Join Date
    06-20-2024
    Location
    Columbia, MD
    MS-Off Ver
    Microsoft365
    Posts
    12

    Re: currency value assigned to variable Error 2023

    Another try to upload the sheet.
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    2,112

    Re: currency value assigned to variable Error 2023

    I think the problem is that you're specifying column 16 when the lookup range consists of 13 columns.

    Needs to be
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    06-20-2024
    Location
    Columbia, MD
    MS-Off Ver
    Microsoft365
    Posts
    12

    Re: currency value assigned to variable Error 2023

    ByteMarks - That did it. Thank you so much for your help.

    Tim

+ 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. [SOLVED] Date error: 29/2/2023 shows Wed 01/03/2023
    By SunOffice in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-26-2023, 08:38 AM
  2. Replies: 5
    Last Post: 03-09-2023, 03:29 AM
  3. Need Formula to Convert this Date Format 2023.02.28 to this 28-Feb-2023
    By gr445854 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-11-2023, 07:04 PM
  4. Replies: 1
    Last Post: 02-03-2023, 04:54 PM
  5. Run-Time Error 2023
    By SKINRIP in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-23-2022, 09:52 AM
  6. [SOLVED] Error 2023: How to identify cell in For Each Loop?
    By VAer in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-12-2018, 12:21 AM
  7. [SOLVED] Error 2023 - triggered by variable - Cant find mistake
    By Taktiker in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-22-2012, 09:11 AM

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