Microsoft
Software
Hardware
Network
Question : Excel VBA Code Problem
A co-worker has an excel 2007 workbook and is using VBA to search for data. The code below is part of an front-end he wrote.
The data in column A contains names, first name, space, last name, such as Charlie Brown, and the code is only filtering the column when the first name is entered in the TextBox. I take it that this is because the contents of the cells in the column, are being treated as a string. He wants to be able to enter either the first name or the last name and get the same results.
Due to the amount of data and other VBA scripts, he can't split the names into 2 separate columns.
Is there a way to change the code below to allow him to do this using either the first or last name
Dim DataSH As Worksheet
Set DataSH = Sheets("SOTDB01")
DataSH.Range("L1").Value = ComboBox1.Value
DataSH.Range("L2").Value = TextBox1.TEXT
DataSH.Range("A1").Current
Region.Adv
ancedFilte
r Action:=xlFilterCopy, criteriarange:=DataSH.Rang
e("L1:L2")
, copytorange:=DataSH.Range(
"N1:X1")
ListBox2.RowSource = "SOTDB01!" & DataSH.Range("FListBox2").
Address
Me.TextBox2.Value = Worksheets("SOTDB01").Rang
e("M2").Va
lue
Answer : Excel VBA Code Problem
put *Glass or *Glass* ;) instead of just Glass
it will do it for Glass too...
Random Solutions
Change CommonProgramFiles
Turn On Shortcut keys selectively to export report.
Should I use SqlDataSource or SqlConnection (which is better)
How to make a PC a thin client?
prevent user to save worksheet
type mismatch with this statement
Command Line for Microsoft Software Inventory Analyzer
The expression you entered contains invalid syntax.
Driver for Maxtor One Touch III
Java.lang.Error: java.lang.reflect.Invocati<wbr />onTargetEx<wbr />ception