UncleBajubjubs
Board Regular
- Joined
- Jul 11, 2017
- Messages
- 111
- Office Version
- 2010
Hello, I currently have a workbook which another worker will enter information into, and which I will then pull information out of into a workbook I use. The workbook they have is a form in which they will fill in all necessary information about a project. I get the workbook from then, open it up, and my workbook copies all the data from it. My only issue is that some of them use an older version of the form, which has a cell's number format as 'text' when it should be 'number'. If I copy this, it messes up the data in my program, so I'm trying to fix the cell prior to copying the data.
I use
Dim filename As Variant
filename = Application.GetOpenFilename()
to open up their workbook to get the data, and I tried
Windows(filename).Activate
Range("P20").Select
Selection.NumberFormat = "General"
but it tells me Subscript out of range on that first line, as the filename contains the entire path of the file (C/User/Documents...etc.). Is there an easy way to remove the file path so that it is just the file name? Unfortunately I can't just have it be a set name, because the others working with it will name it whatever project they are working on.
This is my first post so I tried to have as much information as possible, thank you!
I use
Dim filename As Variant
filename = Application.GetOpenFilename()
to open up their workbook to get the data, and I tried
Windows(filename).Activate
Range("P20").Select
Selection.NumberFormat = "General"
but it tells me Subscript out of range on that first line, as the filename contains the entire path of the file (C/User/Documents...etc.). Is there an easy way to remove the file path so that it is just the file name? Unfortunately I can't just have it be a set name, because the others working with it will name it whatever project they are working on.
This is my first post so I tried to have as much information as possible, thank you!