Copy part of a Cells Text and paste using vba

JEames

New Member
Joined
Nov 17, 2014
Messages
12
Hi,

I know that this is probably really easy but I need help please.

Cell "B6" contains a folder location and file name as follows: \\abc002\Commercial\Live Workbooks\Test Workbook.xlsm
I want Cell A6 to contain the Workbook Name and File Extension only as follows: Test Workbook.xlsm

Any help appreciated.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Try
=TRIM(RIGHT(SUBSTITUTE(B6,"",REPT(" ",100)),100))
 
Upvote 0
Not for me it didn't


Excel 2013/2016
AB
6Test Workbook.xlsm\\abc002\Commercial\Live Workbooks\Test Workbook.xlsm
Sheet1
Cell Formulas
RangeFormula
A6=TRIM(RIGHT(SUBSTITUTE(B6,"",REPT(" ",100)),100))


What are your actual values?
 
Upvote 0
In an unused cell type
=CODE(b6)
What dose it return?
 
Upvote 0
Ok, that's fine.
What does this return
=SUBSTITUTE(B6,"","")
 
Upvote 0
Keep forgetting that the board software has a tendency to strip out \ characters when wrapped i quotes. :banghead:

The formula should be
=TRIM(RIGHT(SUBSTITUTE(B6," \ ",REPT(" ",100)),100))
you need to remove the spaces around the \
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,829
Messages
6,181,219
Members
453,024
Latest member
Wingit77

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top