Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If "P*" = activesheet("A:" & k) Then 1

Status
Not open for further replies.

jhogie

Technical User
Jun 3, 2008
24
CA
I am really tired and just can't figure this out

I am trying to do the following If statement, where k is a integer. I want the If statment to proceed if the contents of cell A:k start with a 'P'.


If "P*" = activesheet("A:" & k) Then

Thanks in advance for the help

- Hogie
 




Hi,

Begins with or ends with is easy, using either the Left or Right function...
Code:
If Left(activesheet.Range("A:" & k),1) = "P" Then
or...
Code:
If activesheet.Range("A:" & k) Like "P*" Then


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
I'd replace this:
Range("A:" & k)
with this:
Range("A" & k)
 
Thanks guys! Once again, Tek-tips comes to the rescue!

- Hogie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top