oldmanwilly
Board Regular
- Joined
- Feb 24, 2016
- Messages
- 221
Hi
I need help i haven't been able to work out the best way to do this:
refresh a formula in myworkbook >>> check to see if a list of file names in my worksheet match the files that are in the same folder >>>if they are, then put a yes next to the file name cell and also put the number of rows that the file has in the cell next to that one>>>if the name isn't there then just leave blank.
I have come up with the code but some bits i cant get to work, please note cell i2 contains the formula =left(cells("filename"),83), this is the only way i could think of to get the workbooks folder path.
Thanks for any help
I need help i haven't been able to work out the best way to do this:
refresh a formula in myworkbook >>> check to see if a list of file names in my worksheet match the files that are in the same folder >>>if they are, then put a yes next to the file name cell and also put the number of rows that the file has in the cell next to that one>>>if the name isn't there then just leave blank.
I have come up with the code but some bits i cant get to work, please note cell i2 contains the formula =left(cells("filename"),83), this is the only way i could think of to get the workbooks folder path.
Thanks for any help
Code:
Sub CHECKFILES()
' IN THIS FOLDER CHECK WHETHER THE FILENAME MATCHES THE ONE IN COLUMN A
Dim MYFOLDER As String
Dim myval As String
Dim myrow As Long
Dim mybook As Workbook
mybook = ThisWorkbook
MYFOLDER = Range("i2").Text
'check if the name matches the cell
For i = 2 To 67
myval = Range("a" & i).Text
if Seek.myval in myfolder = true then
myrow = 'in myfolder & myval count number of rows -1
mybook.Activate
Range("c" & i).Value = 1
Range("d" & i).Value = myrow
Else
Range("c" & i).Value = 0
End If
Next i