Find Column number based on searching of string

With the answer to the previous question:
I now need to determine the column number by finding the text in any cell on the active worksheet.
text = "Customer Mfgnumber Search"

previous question:
previous answer:

If Cells(1, target.column) = "Customer Mfgnumber Search" then
' rest of your code

This will only look in row 1  so...I need to

Find the value in any cell on the workbook and then designate that column as the target column number

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Just use two nested for loops

for longCurrentRow = 1 to 1000 'or whatever number you choose ... typically this should be extracted from ActiveRegion
   for longCurrentColumn = 1 to 1000 'or whatever number you choose
      if Cell(longCurrentRow, longCurrentColumn) = 'Customer Mfgnumber Search' then
          'rest of your code
      end if


Dim found As Range
Set found = Cells.Find("Customer Mfgnumber Search")
If found is nothing then
   column = 0 ' ?? not found
   column = found.Column
End If
FordraidersAuthor Commented:
So either one of these answers will give the column number where the value was found ?
cyberkiwi ?
   column = found.Column    <----- here
End If
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

FordraidersAuthor Commented:
option explicit

how to define column ?

just to make sure

FordraidersAuthor Commented:
The reason I'm asking I need to pass the Column to a target intersect

Dim Result As String
   Set targ = Intersect(target, [C:C])   <---- HERE

what ever the column is,  that the value was found, I need to know it for this part in the code..
("Customer Mfgnumber Search")

I need to tranlate that column Number to a column Letter..?


What do you do when it is not found?  Assuming it is found...

Dim found As Range
Set found = Cells.Find("Customer Mfgnumber Search") ' found is a Range object

Dim Result As String
If Not found is nothing then
    Set targ = Intersect(target, found.EntireColumn) '  <---- HERE
    ' ?? what to do here
End If

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
FordraidersAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.