Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-23-2015, 11:28 AM
Macer Macer is offline How do you remove part of a formula Windows 7 64bit How do you remove part of a formula Office 2007
Novice
How do you remove part of a formula
 
Join Date: Jan 2015
Posts: 9
Macer is on a distinguished road
Default How do you remove part of a formula

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.
Reply With Quote
  #2  
Old 09-23-2015, 01:06 PM
NoSparks NoSparks is offline How do you remove part of a formula Windows 7 64bit How do you remove part of a formula Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 831
NoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really nice
Default

Perhaps something like this ?
Code:
Sub RemovePathAndFileName()

    Dim str As String
    
str = Range("A2").Formula
MsgBox "'" & Mid(str, InStrRev(str, "]") + 1)

End Sub
Reply With Quote
  #3  
Old 09-24-2015, 11:08 AM
Macer Macer is offline How do you remove part of a formula Windows 7 64bit How do you remove part of a formula Office 2007
Novice
How do you remove part of a formula
 
Join Date: Jan 2015
Posts: 9
Macer is on a distinguished road
Default

Thanks that helped.
Reply With Quote
Reply



Similar Threads
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
How do you remove part of a formula Searching for part, BUT NOT ALL, of a word... MikeWebster2000 Outlook 2 09-27-2013 06:35 AM
How do you remove part of a formula Need an excel formula to remove dashes in a number sequence 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

Other Forums: Access Forums

All times are GMT -7. The time now is 10:27 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft