FindColumn is an Excel™ VBA Function that will look for the first occurrence of the passed string in a column and return the column number.

There are three possible parameters, the first one is required the others are optional. These parameters are:
  1. (Required) The string to be searched for.

  2. (Optional) The worksheet to be searched. If omitted then "Dashboard" will be used.

  3. (Optional) True or False. This tells FindColumn whether a partial match is allowed or not. The default is False so the entire string must match the entire column contents (xlWhole used). True would allow a partial match (xlPart used).

To illustrate the use of FindColumn we will use the following worksheet named "Demo".

FindColumn Demo Sheet


Using the above worksheet the following code would return value of 4 (i.e the first column with the word "Value" in it)

FindColumn("Value", "Demo", True)

However coding:

FindColumn("Value", "Demo", False)

would return a value of 0 as no column contains only the word "Value".


if, however you code:

FindColumn("Value", "Book Demo", False)

a value of 5 will be returned.

FindColumn will find the text in any row, not just the first, for example:

FindColumn("Eisenhower", "Demo")

will return a value of 6.

Note: FindColumn requires the subroutine WorksheetExtant to be available.

The FindColumn function is avaliable from here.

As normal the usual disclaimers apply.

 
 


If you need any support or assistance with any of the code on this site
or
if you would like to contact us, please click here

follow us on facebook
Follow us on Facebook

 

Number of unique visitors 377

Copyright © Abbydale Systems LLC 2015-2024

Abbydale Systems LLC Lic. 802696149. All rights reserved.

Last modified : Saturday 23rd of July 2022