![]() |
#1
|
|||
|
|||
![]()
The basic goal is to remove part of a formula so that the new formula is looking at the correct cell. For example, I want to get the formula
='C:\filepath\[filename]Sheet1'!A4 To be ='Sheet1'!A4 So I am basically trying to remove the file name from the cell. So that it will look at the sheet in the current file rather than the previous one. The issue is that the file path or name won't always be the same. I have tried to use the I have tried to use Filter and Replace mixed with wildcards, but no luck. |
#2
|
|||
|
|||
![]()
Perhaps something like this ?
Code:
Sub RemovePathAndFileName() Dim str As String str = Range("A2").Formula MsgBox "'" & Mid(str, InStrRev(str, "]") + 1) End Sub |
#3
|
|||
|
|||
![]()
Thanks that helped.
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to colour this part? | mindfire | Project | 1 | 11-17-2014 06:07 PM |
Changing a part of vba code | Milade8080 | Excel Programming | 2 | 09-11-2014 10:34 PM |
![]() |
MikeWebster2000 | Outlook | 2 | 09-27-2013 06:35 AM |
![]() |
jyfuller | Excel Programming | 3 | 02-27-2013 10:32 PM |
Print Part of a Slide | Cpt Black | PowerPoint | 0 | 12-12-2008 10:30 AM |