![]() |
IF statement Question
hello everyone
I have a question about if statments in programming. First is can wildcards be used. I want to check if a column has words that start with FA_Panels_. There are about 6 different names that start with that word, example FA_Panels_NAC, FA_Panels_FACP, FA_Panels_VESDA,ETC.. I don't want to write a IF statment for each one. |
IF statement Question
Hi,
Yes you can use the 'Like' operator If Range("A1").Value Like "Fa*" Then End If Mike "Novice Lee" wrote: hello everyone I have a question about if statments in programming. First is can wildcards be used. I want to check if a column has words that start with FA_Panels_. There are about 6 different names that start with that word, example FA_Panels_NAC, FA_Panels_FACP, FA_Panels_VESDA,ETC.. I don't want to write a IF statment for each one. |
IF statement Question
the below will work from column 'A2'
=IF(LEFT(A2,10)="FA_Panels_","yes","no") "Novice Lee" wrote: hello everyone I have a question about if statments in programming. First is can wildcards be used. I want to check if a column has words that start with FA_Panels_. There are about 6 different names that start with that word, example FA_Panels_NAC, FA_Panels_FACP, FA_Panels_VESDA,ETC.. I don't want to write a IF statment for each one. |
IF statement Question
Novice Lee wrote:
I have a question about if statments in programming. First is can wildcards be used. I want to check if a column has words that start with FA_Panels_. There are about 6 different names that start with that word, example FA_Panels_NAC, FA_Panels_FACP, FA_Panels_VESDA,ETC.. I don't want to write a IF statment for each one. If (Left (columnName, Len ("FA_Panels_")) = "FA_Panels_") Then ' do something End If HTH, Lars |
IF statement Question
Modified from the vba help index for FINDNEXT.
Sub findtext() With Worksheets("sheet3").Range("g1:g50") Set c = .Find("FA_Panels", LookIn:=xlValues, lookat:=xlPart) If Not c Is Nothing Then firstAddress = c.Address Do 'c.Value = 5 MsgBox c.Row Set c = .FindNext(c) Loop While Not c Is Nothing And c.Address < firstAddress End If End With End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Novice Lee" wrote in message ... hello everyone I have a question about if statments in programming. First is can wildcards be used. I want to check if a column has words that start with FA_Panels_. There are about 6 different names that start with that word, example FA_Panels_NAC, FA_Panels_FACP, FA_Panels_VESDA,ETC.. I don't want to write a IF statment for each one. |
IF statement Question
Don Guillett wrote:
Modified from the vba help index for FINDNEXT. [.. lots of code ..] Motto: Why do it the easy way, when there's a complicated one? *g* S,CNR, Lars |
All times are GMT +1. The time now is 02:39 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com