PDA

View Full Version : Solved: Filtering out cell contents



sebas1102
06-19-2006, 08:26 PM
Hi all,
I have a number "3059-006" in cell A1 , "Q5/1.2" in cell B1.
I need to sift out "3059-" form A1 and "Q5" from B1 so that i can assign


ExcelFileName= 3059-Q5.
Workbook = "ExcelFileName.xls"
If Not WorkbookOpen(Workbook) Then
Workbooks.Open "c:\project\" & Workbook
End If


Is it Possible? Thanks in Advance!

acw
06-19-2006, 10:49 PM
Hi

Try

excelfilename = Left(Range("a1"), InStr(1, Range("a1"), "-"))
excelfilename = excelfilename & Left(Range("B1"), InStr(1, Range("B1"), "/") - 1) & ".xls"
If Not WorkbookOpen(excelfilename) Then
Workbooks.Open "c:\project\" & excelfilename
End If



Tony

sebas1102
06-19-2006, 11:33 PM
wow thats amazing thanks!
may i know what exactly does instr and left do?