Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Select specific text in cell

Sorry, but I am not up to speed on my RegEx yet... would that retain the
c:
from the front of the path or not?

If there were no "\" after the C:, then it would be retained. But if
the
C:
represents a drive, is C:filename legal? OR must it be C:\filename


Yes, c:filename is legal. In the flurry of postings we have done, you
missed
my 2:40PM (EST) message. I am repeating it here so you don't have to look
for it... see my test() subroutine and note in particular the
path/filename
used in the Open statement.

Expanding -- it would certainly be possible for a parser in which the
"\"
preceding the filename was optional


Which is, of course, a possibility; though, in today's type file
referencing, somewhat rare. If the default path is at the directory where
the file is located, then you can legally specify the file using something
like this... c:filename.ext and the operating system will look in the
current directory. On my system, there is a directory called TEMP at the
root level of my C: drive. In that directory is a file named Test.txt. The
following code (showing a 'backslashless' path reference) prints the first
line of the file into the Immediate window...

Sub test()
ChDir "c:\temp"
Open "c:test.txt" For Input As #1
Line Input #1, LineOfText
Close #1
Debug.Print LineOfText
End Sub

Rick


Well, as written, the regex would retain the C:.

If you wanted to return filename without the C:, it would be a simple
alteration in the regex:

re.Pattern = "([^\\:]*\S)\s?-[^\\]*$"

This is a bit more robust, though:

re.Pattern = "([^\\:]*\S)\s*-[^\\]*$"


I wouldn't worry about it. Even though it is legal to have a path with no
backslashes, almost no one does so anymore as it requires some mechanism to
change the active directory path in order to use it. One would hardly store
paths in that format with the requirement that to use them, a certain path
has to be made active.

Rick

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
IF a cell contains specific text Christine Excel Discussion (Misc queries) 6 April 23rd 23 07:46 PM
cell location containing specific text Gregg R Excel Worksheet Functions 8 April 9th 07 09:25 PM
Macro - Select cell with no text Dileep Chandran Excel Worksheet Functions 3 December 6th 06 06:01 AM
Select cell containing specific text &return value from another ce plf100 Excel Worksheet Functions 4 November 16th 05 01:57 PM
Select specific cell Shawn Excel Discussion (Misc queries) 1 April 28th 05 09:00 PM


All times are GMT +1. The time now is 09:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"