Cells.Find

  • Thread starter Thread starter Mike R.
  • Start date Start date
M

Mike R.

Is there a way to use a string variable as a parameter for
the Cells.Find function when using VBA for Excel. For
example, given:

Function PrintCustomerMessageCell(CMessage As String)

'Place focus on the cell that contains this data
Cells.Find(CustomerMessage).Activate
'I get an error in the line above.

'Tell me what cell it is
MsgBox ActiveCell.AddressLocal(RowAbsolute:=False,
ColumnAbsolute:=False)


End Function


Thank you...
 
PrintCustomerMessageCell - name of function
CMessage - string passed into function
CustomerMessage - undefined uninitialized variable that contains no value to
search for

Yes, find can search for a string argument.
 
I found a mispelled word that I was passing to my function
as a string which made the function fail. Thank you..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top