Autofill based on filename in same/different folder.
Closed
Jacek
-
Nov 25, 2016 at 10:07 AM
yg_be Posts 23346 Registration date Sunday June 8, 2008 Status Contributor Last seen November 24, 2024 - Nov 28, 2016 at 06:21 AM
yg_be Posts 23346 Registration date Sunday June 8, 2008 Status Contributor Last seen November 24, 2024 - Nov 28, 2016 at 06:21 AM
Related:
- Autofill based on filename in same/different folder.
- Anvi folder locker reset key - Guide
- Steam screenshot folder - Guide
- How to make a folder on samsung - Guide
- Gmail important folder - Guide
- Ps3 update folder - Guide
1 response
yg_be
Posts
23346
Registration date
Sunday June 8, 2008
Status
Contributor
Last seen
November 24, 2024
5
Nov 25, 2016 at 01:16 PM
Nov 25, 2016 at 01:16 PM
I propose this :
You must, via the Tools/References menu in VBA Editor, add "Microsoft Scripting Runtime" to you project.
Option Explicit Sub jacek() Dim filesys As Scripting.FileSystemObject Dim myfolder As Scripting.Folder Dim onefile As Scripting.File Set filesys = New Scripting.FileSystemObject Dim filename As String Dim aa As String, bb As String, cc As String Set myfolder = filesys.GetFolder("path to the folder") For Each onefile In myfolder.Files filename = onefile.Name If Right(filename, 4) = ".jpg" Then aa = Left(filename, 2) bb = Mid(filename, 3, 2) cc = Mid(filename, 5, 2) If CInt(aa) = Range("a1") Then If CInt(bb) = 23 Then Range("b2").Value = "X" End If End If End If Next End Sub
You must, via the Tools/References menu in VBA Editor, add "Microsoft Scripting Runtime" to you project.
Nov 28, 2016 at 04:51 AM
Nov 28, 2016 at 06:21 AM