Consulting

Results 1 to 3 of 3

Thread: VBA error

  1. #1
    VBAX Regular
    Joined
    Nov 2020
    Posts
    11
    Location

    VBA error

    Hello!
    I would like to seek your help in this issue below.

    Every month, I have a list of invoice numbers which my colleagues save into folder.
    For some months, they might save the invoice numbers in a range.
    For other months, they might save individual invoice number.

    As for certain months the invoice numbers are saved in a range, I have my macro to insert blank rows and auto fill the blank rows.
    (Eg. INVOICE1-20 <- this could be the file name, my macro will insert blank rows and auto fill and it looks like INVOICE1, INVOICE2... etc)
    My macro works if the invoice numbers are saved in a range.

    However, my macro encounter errors when the list of invoices for that month ain't save in a range.

    I tried to debug and continue to run, but keep prompting me the same issue as there is nothing for the macro to fill any blanks. there are no blanks at all.
    The error is in the attachment.

    How can I get my macro to ignore the command to fill blanks, if there are no blanks to fill?

    VBA ERROR.JPG

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,726
    Location
    On Error Resume Next
    
    Columns .......
    
    On Error Goto 0
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    Moderator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,194
    Location
    Might be worth restricting the entire column to the used range within the column, I am sure you will not need every blank cell in the column filled with formulae.
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved
    Click here for a guide on how to upload a file with your post (you may need to click 'Go Advanced')

    Excel 365, Version 2403, Build 17425.20146

Posting Permissions

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