VBA question

vbalearner11

New Member
Joined
Jan 19, 2018
Messages
18
What does a val(len(filename)) does if file name "1. projects" and "Projects"

WIll be waiting for your response.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Re: VBA question - Need an immediate response please!!!!!!!!

What does a val(len(filename)) does if file name "1. projects" and "Projects"

WIll be waiting for your response.
Val will return the leading number from a text string, so for your two examples, it would return 1 for the first one and 0 for the second one. There is one caution about using Val if the format of your text strings are not well controlled... Val will make a number if it can, so for example...

Val("3E9 Drawer") and Val("3D9 Drawer"

where the D and E can be either upper or lower case, will return 3000000000 as the answer, not 3, because 3E9 and 3D9 are proper numbers in VB (they powers of 10 notation). Also, something like this...

Val("&HEADER")

will return -5410, not 0, because the leading ampersand and letters from A to Z (again, upper or lower case) form a proper hexadecimal number in VBA. There are other exceptions as well which is why I said you text values have to be well controlled.
 
Upvote 0
Re: VBA question - Need an immediate response please!!!!!!!!

Wouldnt that just produce the length of the string Rick?
 
Upvote 0
Re: VBA question - Need an immediate response please!!!!!!!!

This: val(len(filename))
I completely overlooked the Len function call in the OP's original question. :oops:

Of course, once the Len function call has been applied, the Val function call is not needed as a number is already a number and does not need Val to make it into one.
 
Upvote 0
Re: VBA question - Need an immediate response please!!!!!!!!

I was just typing the Val part is irrelevant then doubted myself!
 
Upvote 0
Re: VBA question - Need an immediate response please!!!!!!!!

FolderLoc = FolderLoc & "" & "Jan" & ". " & Year 'Inside the Folderloc there are ten's of file and each and every files has atleast three more files in it.
Set FSobj = CreateObject("Scripting.FileSystemObject")
Set ProjectsFolderObj = FSobj.GetFolder(FolderLoc)
For Each BCFolderObj In ProjectsFolderObj.SubFolders
DoEvents

May I know what each step is doing
 
Upvote 0
Re: VBA question - Need an immediate response please!!!!!!!!

Any idea what does this mean If Left(BCFileObj.Name, 1) <> "~" Then ????
Is there any special about the symbol "~"?
 
Upvote 0

Forum statistics

Threads
1,215,957
Messages
6,127,936
Members
449,411
Latest member
AppellatePerson

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