excel vba - Partial string searches with VBA -


i trying write macro searching , displaying rows of data based on search term partial string (typically 4 characters of potentially 16), complete beginner @ far have following (with gord):

    private sub worksheet_change(byval target range) dim cell range application.screenupdating = false activesheet     .rows.hidden = false    'unhides rows end each cell in activesheet.range("c3:c1000")     if cell.value <> activesheet.range("a1").value _             cell.entirerow.hidden = true     if activesheet.range("a1").value = ""         cell.entirerow.hidden = false     end if next range("a1").select  'ready next value input application.screenupdating = true end sub 

how can define search term partial match not exact match , loose case senstivity?

tia

duncan

the data string has no special characters 0-9 , a-z presumably function suit task. if how macro change? apologies total newbie @ this. tried editing: if activesheet.range("a1").value = "" then
to: if activesheet.range("a1").value "*" no result

first try convert both strings (needle , haystack) lcase() , use like operator. in example below

if lcase(haystack) "*" & lcase(needle) & "*" 'do 

which works little regexp. string haystack if contains needle. * means (or nothing). clear?


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -