Results 1 to 6 of 6

Thread: [RESOLVED] Excel Custon Validation Formula

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2020
    Posts
    7

    Resolved [RESOLVED] Excel Custon Validation Formula

    Hi All,

    I'm writing a xlsx file directly from vb.net
    I have a problem when I try to add a cell custom validation formula with this istruction:

    HTML Code:
    Sub AddValidationFormula(byval range as range)
       dim validationFormula as string = "=mod(C2,F2)=0"
       range.Validation.Add(XlDVType.xlValidateCustom, XlDVAlertStyle.xlValidAlertStop, validationFormula) 
    End Sub
    The validationFormula above indicated is an semplified formula that I have try to used to solve my problem.

    When I run my code, it crashes with "exception from HRESULT: 0x800A03EC".
    I have also tryed the italian Fornula ("=RESTO") but without result.

    If I write the formula directly in the Excel file, I don't have any problem.

    I have attached the stackTrace error

    Can anyone help me?

    Thanks

    Marcello
    Attached Files Attached Files
    Last edited by Semola; Sep 9th, 2022 at 12:35 AM.

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width