Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8591671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:34:46+00:00 2026-06-11T23:34:46+00:00

Using the code below, I am trying to extrapolate the column letter of to

  • 0

Using the code below, I am trying to extrapolate the column letter of to the right of a column where a defined value exists. For example, if D1 = ‘Postcode’, I want insert_col to equal ‘E’.

This works if the value ‘Postcoade’ exists in title_range, but if it does not I get an error on the last line (Type mismatch).

According to the docs for Match, if the lookup value does not exist in the reange, the Excel error “N/A” is returned, but checking for xlErrNA to exit the function does not work.

' Work out the column to insert
insert_col_pos = Application.Match("Postcode", title_range, 0)
If insert_col_pos = xlErrNA Then Exit Function ' Exit if the column to insert next to does not exist
insert_col = GetInsertCol(insert_col_pos + 1)

Does any body know what I am doing wrong? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T23:34:48+00:00Added an answer on June 11, 2026 at 11:34 pm

    What you want is

    If insert_col_pos = CVErr(xlErrNA) Then Exit Sub   
    

    Provided that insert_col_pos is Dim‘ed as Variant

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get the column names using the code below but it returns
I'm trying to update a value in my app.config file using the code below
I'm using the javascript code below trying to extract the number after gallery-entry_ in
Afternoon all, Using the code below I'm trying to load what is render by
I'm trying to display a text using the code below. The problem is that
I was trying to read a lot of numbers dynamically using the code below
I'm trying to create a custom drop down and using the code below it
I'm trying to draw the pages of a PDF using the code below. Some
I am trying to access an SQLite 3 database programmatically using the code below:
I am trying to change desktop image using below code: NSError *anError = nil;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.